[gdal-dev] [OSGeo-Discuss] Help with GDAL EPSGTreatsAsLatLong

Even Rouault even.rouault at spatialys.com
Sun Aug 28 03:07:51 PDT 2016


Filipe,

(answering on gdal-dev which is the appropriate place for GDAL specific 
questions)

> Hi,
> 
> I have project on github to convert a map to covjon (https://covjson.org/)
> format, I am now trying
> to get the map axis orientation I am doing it with EPSGTreatsAsLatLong:
> 
> https://github.com/fsvieira/map2covjson/blob/master/map2covjson.cpp#L102
> 
> The problem is that I am always getting 0 (FALSE) to a map that I think it
> should be Lat/Lon.

Your geotiff is using EPSG:32629 as the projected coordinate system. EPSG:32629 
uses easting, northing ordering.

Calling EPSGTreatsAsLatLong() on a projected coordinate system doesn't make 
sense since it is intended for geographic coordinate system

For projected coordinate systems, you should rather call 
EPSGTreatsAsNorthingEasting()  : 
http://www.gdal.org/classOGRSpatialReference.html#a2fe484ea1e7c8e8121b3ae05bb1a1878
which will also return FALSE in that instance.

You can check if a CRS is projected or not with 
OGRSpatialReference::IsProjected() :
http://www.gdal.org/classOGRSpatialReference.html#a1186e3473d7ac2f81ec2ca5d0c4ec027

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list