[gdal-dev] OGRCreateCoordinateTransformation problem on GDAL 3.0.3 and PROJ 6.3.0

Edzer Pebesma edzer.pebesma at uni-muenster.de
Thu Jan 23 06:53:46 PST 2020


The combination of GDAL 3.0.3 and PROJ 6.3.0 arriving on debian
platforms is causing some havoc for some spatial R packages. I could
bring one particular problem back to the following C++ program:

#include <stdio.h>
#include "ogrsf_frmts.h"
#include <ogr_spatialref.h>

int main() {

   OGRSpatialReference *aSRS = new OGRSpatialReference;
   OGRSpatialReference *bSRS = new OGRSpatialReference;

   char *pszSRS = NULL, *wkta = NULL, *wktb = NULL;

   aSRS->importFromProj4("+init=epsg:4326");
   aSRS->exportToPrettyWkt(&wkta);
   aSRS->importFromWkt((const char *) wkta);

   bSRS->importFromProj4("+init=epsg:3857");
   bSRS->exportToPrettyWkt(&wktb);
   bSRS->importFromWkt((const char *) wktb);

   OGRCoordinateTransformation *ct =
OGRCreateCoordinateTransformation(aSRS, bSRS);
   if (ct == NULL) {
	printf("ct NULL\n");
	exit(1);
   }
   exit(0);
}

which outputs:

Warning 1: +init=epsg:XXXX syntax is deprecated. It might return a CRS
with a non-EPSG compliant axis order.
ERROR 1: PROJ: proj_create_operations: At least one of the operation
lacks a source and/or target CRS
ERROR 6: Cannot find coordinate operations from `GEOGCRS["WGS
84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS
84",6378137,298.257223563,LENGTHUNIT["metre",1]],ID["EPSG",6326]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]],CS[ellipsoidal,2],AXIS["longitude",east,ORDER[1],ANGLEUNIT["degree",0.0174532925199433,ID["EPSG",9122]]],AXIS["latitude",north,ORDER[2],ANGLEUNIT["degree",0.0174532925199433,ID["EPSG",9122]]]]'
to `PROJCRS["WGS 84 / Pseudo-Mercator",BASEGEOGCRS["WGS 84",DATUM["World
Geodetic System 1984",ELLIPSOID["WGS
84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["unnamed",METHOD["Popular
Visualisation Pseudo Mercator",ID["EPSG",1024]],PARAMETER["Latitude of
natural
origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude
of natural
origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["False
easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False
northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]'
ct NULL

What am I doing wrong?
-- 
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48151 Muenster, Germany
Phone: +49 251 8333081
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pEpkey.asc
Type: application/pgp-keys
Size: 3110 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200123/f49841fd/attachment.key>


More information about the gdal-dev mailing list