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

Joaquim Luis jluis at ualg.pt
Fri Aug 25 16:46:42 PDT 2017



>
> Yes that's not obvious but internally SRS in GDAL are not modelled as a  
> proj.4 string, but as WKT. So there's a importFromProj4() and  
> exportFromProj4(), and >possible loss can happen when some concepts  
> cannot be matched exactly.
>
>
>> Found these two that not even with the +wktext agree
>
>
> Perhaps you don't use the same proj.4 version ?

Yep, I was using a 4.8 version from  OSGeo4W. With 4.9.3 I get the same as  
with GDAL



>
>
>>
>
>>
>
>> gdaltransform -s_srs EPSG:4326 -t_srs "+proj=aeqd +ellps=WGS84 +units=m
>
>> +wktext"
>
>> 4.897 52.371
>
>> 384537.462362467 5809944.80754693 0
>
>>
>
>> echo 4.897 52.371 | proj +proj=aeqd +ellps=WGS84 +units=m
>
>> 384923.72       5809986.5
>
>
> I get the same result as GDAL (with proj 4.9.2)
>
>
> $ echo 4.897 52.371 | proj +proj=aeqd +ellps=WGS84 +units=m
>
> 384537.46	5809944.81
>
>
>>
>
>>
>
>>
>
>> gdaltransform -s_srs EPSG:4326 -t_srs "+proj=robin +ellps=WGS84 +units=m
>
>> +wktext"
>
>> 4.897 52.371
>
>> 394576.527707384 5570940.8420985 0
>
>>
>
>> echo 4.897 52.371 | proj +proj=robin +ellps=WGS84 +units=m
>
>> 394576.51       5571243.64
>
>
> $ echo 4.897 52.371 | proj +proj=robin +ellps=WGS84 +units=m
>
> 394576.53	5570940.84
>
>
>
>>
>
>> > 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/te
>
>> >> st_
>
>> >>
>
>> >>
>
>> >>
>
>> >> 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
>
>
>
> --
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170826/f2ce6f45/attachment-0001.html>


More information about the gdal-dev mailing list