[gdal-dev] Which Proj.4 transforms are available in GDAL?

Even Rouault even.rouault at spatialys.com
Fri Aug 25 04:52:14 PDT 2017


Joaquim,

> 
> I'm implementing Proj.4 in GMT via GDAL and now, in the the testing stage,
> I'm using data from
> 
> https://github.com/Beman/boost-trunk-git-svn/blob/master/libs/geometry/test_
> extensions/gis/projections/projections.cpp#L121
> 
> but to my surprise lots of projections are not implemented in GDAL. For
> example

GDAL SRS model is based on WKT, so only projections that have a mapping to WKT 1 (and for which a developer cared enough to write the needed code !) are nominally supported

> 
> gdaltransform -s_srs EPSG:4326 -t_srs +proj=airy +ellps=WGS84 +units=m

For unsupported projections, add +wktext. A dummy WKT representation is then built that captures the full proj.4 string in a EXTENSION node. Can also serve for supported projections if you want to overrite the WKT -> proj.4 string conversion done by GDAL

$ gdalsrsinfo "+proj=airy +ellps=WGS84 +units=m +wktext"

PROJ.4 : +proj=airy +ellps=WGS84 +units=m +wktext

OGC WKT :
PROJCS["unnamed",
    GEOGCS["WGS 84",
        DATUM["unknown",
            SPHEROID["WGS84",6378137,298.257223563]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["custom_proj4"],
    UNIT["Meter",1],
    EXTENSION["PROJ4","+proj=airy +ellps=WGS84 +units=m +wktext"]]


$ gdaltransform -s_srs EPSG:4326 -t_srs "+proj=airy +ellps=WGS84 +units=m +wktext"

> ERROR 1: Translating source or target SRS failed:
> +proj=airy
> 
> Or
> 
> gdaltransform -s_srs EPSG:4326 -t_srs +proj=bonne
> ERROR 6: Failed to initialize PROJ.4 with `+proj=bonne +lon_0=0 +lat_1=0
> +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs'.
> 

I thing the issue is that lat_1=0 is invalid for bonne. Any non zero value is OK

> 
> Is there a place where I can find the list of available proj.4 transforms?
> 
> 

You mean projections supported by GDAL (as far as I know, most if not all projections supported by GDAL translate then to proj.4) ?

Look at the various OSRSetXXXXX() methods in
http://gdal.org/ogr__srs__api_8h.html

Or starting there
https://github.com/OSGeo/gdal/blob/trunk/gdal/ogr/ogr_srs_proj4.cpp#L616


> 
> And also found some that do no agree between GDAL and proj. For example
> 
> echo 4.897 52.371 | proj +proj=vandg +ellps=WGS84 +units=m
> 489005.93       6431581.02
> 
> gdaltransform -s_srs EPSG:4326 -t_srs "+proj=vandg +ellps=WGS84 +units=m"
> 4.897 52.371
> 488459.293282675 6424391.46347316 0

If you add --debug on, you'll see that GDAL adds a +R_A parameter. I haven't dug up into history to know the reason for that.
If you add +wktext, the original string will be passed unmodified to proj.4

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170825/6fe3c339/attachment.html>


More information about the gdal-dev mailing list