Skip to content

Commit

Permalink
Fix crs export to wkt on proj 6
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 15, 2019
1 parent aa21d55 commit 3bab21d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -1369,12 +1369,21 @@ QString QgsCoordinateReferenceSystem::toWkt() const
{
if ( d->mWkt.isEmpty() )
{
#if PROJ_VERSION_MAJOR>=6
// TODO QGIS 4.0 - upgrade to wkt2 (this would be an API break).
if ( d->mPj )
{
const char *const options[] = {"MULTILINE=NO", "INDENTATION_WIDTH=0", nullptr};
d->mWkt = QString( proj_as_wkt( QgsProjContext::get(), d->mPj.get(), PJ_WKT1_GDAL, options ) );
}
#else
char *wkt = nullptr;
if ( OSRExportToWkt( d->mCRS, &wkt ) == OGRERR_NONE )
{
d->mWkt = wkt;
CPLFree( wkt );
}
#endif
}
return d->mWkt;
}
Expand Down

0 comments on commit 3bab21d

Please sign in to comment.