[gdal-dev] Troubles in coord conversions with GDAL+proj6

Joaquim Manuel Freire Luís jluis at ualg.pt
Sun Feb 24 05:46:55 PST 2019


OK,

Will try to do that this afternoon in the train back home but already anticipating a problem. Matlab does not print what C code prints to stderr so I'll have to find a way to get that debug info.

|>-----Original Message-----
|>From: Even Rouault <even.rouault at spatialys.com>
|>Sent: Sunday, February 24, 2019 1:29 PM
|>To: gdal-dev at lists.osgeo.org
|>Cc: Joaquim Manuel Freire Luís <jluis at ualg.pt>
|>Subject: Re: [gdal-dev] Troubles in coord conversions with GDAL+proj6
|>
|>Joaquim,
|>
|>>
|>> I'm having troubles migrating some of my Matlab mex to recent GDAL
|>> (built yesterday from git). With older GDAL versions all went well.
|>> For example, this is correct
|>> >> prj.SrcProjSRS = '+proj=utm +zone=29 +datum=WGS84 +units=m
|>> >> +no_defs'; xy = ogrproj([0 0], prj)
|>>
|>> xy =
|>>
|>>  -13.488743884387196                   0
|>>
|>> But with newest version I'm having two problems
|>>
|>> >> prj.SrcProjSRS = '+proj=utm +zone=29 +datum=WGS84 +units=m
|>> >> +no_defs'; xy = ogrproj([0 0], prj)
|>>
|>> xy =
|>>
|>>   -0.000121660050290 -13.488743885487231
|>>
|>> One is that coordinates are not correct (lat should be 0.0)
|>
|>That one is really odd. It looks like some datum shift would be applied, which
|>doesn't make sense here since your target SRS uses WGS84 too. Can you run
|>your code with PROJ_DEBUG=5 and CPL_DEBUG=ON environment variables set
|>?
|>
|>For correct results, you should see something like:
|>OGRCT: proj=pipeline step inv proj=utm zone=29 ellps=WGS84 step
|>proj=unitconvert xy_in=rad xy_out=deg step proj=axisswap order=2,1 (Inverse
|>of UTM zone 29N)
|>
|>
|>> and the other is
|>> that in this later case it outputs lat,long instead of lon,lat
|>
|>That one is expected. SetWellKnownGeogCS( "WGS84" ) now returns a SRS
|>with lat, lon order. You can force "GIS" friendly order by calling
|>oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
|>
|>Even
|>
|>--
|>Spatialys - Geospatial professional services http://www.spatialys.com


More information about the gdal-dev mailing list