<div dir="ltr"><div dir="ltr">Hi,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 23, 2020 at 8:01 AM Edzer Pebesma <<a href="mailto:edzer.pebesma@uni-muenster.de">edzer.pebesma@uni-muenster.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The combination of GDAL 3.0.3 and PROJ 6.3.0 arriving on debian<br>
platforms is causing some havoc for some spatial R packages. I could<br>
bring one particular problem back to the following C++ program:<br>
<br>
#include <stdio.h><br>
#include "ogrsf_frmts.h"<br>
#include <ogr_spatialref.h><br>
<br>
int main() {<br>
<br>
   OGRSpatialReference *aSRS = new OGRSpatialReference;<br>
   OGRSpatialReference *bSRS = new OGRSpatialReference;<br>
<br>
   char *pszSRS = NULL, *wkta = NULL, *wktb = NULL;<br>
<br>
   aSRS->importFromProj4("+init=epsg:4326");<br>
   aSRS->exportToPrettyWkt(&wkta);<br>
   aSRS->importFromWkt((const char *) wkta);<br>
<br>
   bSRS->importFromProj4("+init=epsg:3857");<br>
   bSRS->exportToPrettyWkt(&wktb);<br>
   bSRS->importFromWkt((const char *) wktb);<br>
<br>
   OGRCoordinateTransformation *ct =<br>
OGRCreateCoordinateTransformation(aSRS, bSRS);<br>
   if (ct == NULL) {<br>
        printf("ct NULL\n");<br>
        exit(1);<br>
   }<br>
   exit(0);<br>
}<br>
<br>
which outputs:<br>
<br>
Warning 1: +init=epsg:XXXX syntax is deprecated. It might return a CRS<br>
with a non-EPSG compliant axis order.<br>
ERROR 1: PROJ: proj_create_operations: At least one of the operation<br>
lacks a source and/or target CRS<br>
ERROR 6: Cannot find coordinate operations from `GEOGCRS["WGS<br>
84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS<br>
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]]]]'<br>
to `PROJCRS["WGS 84 / Pseudo-Mercator",BASEGEOGCRS["WGS 84",DATUM["World<br>
Geodetic System 1984",ELLIPSOID["WGS<br>
84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["unnamed",METHOD["Popular<br>
Visualisation Pseudo Mercator",ID["EPSG",1024]],PARAMETER["Latitude of<br>
natural<br>
origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude<br>
of natural<br>
origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["False<br>
easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False<br>
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]]]]'<br>
ct NULL<br>
<br>
What am I doing wrong?</blockquote><div><br></div><div>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.</div><div><br></div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Sean Gillies</div></div></div>