On 1/23/20 5:29 PM, Sean Gillies wrote: > Hi, > > On Thu, Jan 23, 2020 at 8:01 AM Edzer Pebesma > <edzer.pebe...@uni-muenster.de <mailto:edzer.pebe...@uni-muenster.de>> > wrote: > > 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? > > > If you pass "EPSG:4326" to importFromProj4 instead of "+init=epsg:4326" > (and likewise for EPSG:3857) the deprecated syntax warning won't be > printed. I expect that the error would be cleared up too, at least that > is my experience with the latest in these libraries.
Thanks! Yes, with SRS->importFromUserInput("EPSG:3857"); etc this works fine; I'm OK with the warning, I just don't see how the subsequent error relates to syntax that is deprecated. -- Edzer Pebesma Institute for Geoinformatics Heisenbergstrasse 2, 48151 Muenster, Germany Phone: +49 251 8333081
pEpkey.asc
Description: application/pgp-keys
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev