[gdal-dev] proposal for a new GDAL/OGR utility app: gdalsrsinfo
Etienne Tourigny
etourigny.dev at gmail.com
Sun Oct 16 20:38:41 EDT 2011
I have written a small utility app that I think would make a nice
addition to the GDAL Utilities.
gdalsrsinfo (provisional name) processes an input SRS definition (or
dataset) and outputs the SRS definition in one or all of the formats
which GDAL can export to (WKT, PROJ.4, ESRI WKT, mapserver, xml).
It accepts a valid GDAL dataset or any of the usual GDAL/OGR forms. It
could be extended to accept OGR datasets (already supports .prj
files).
In my opinion it is useful because it allows easy access to the
different SRS forms supported by GDAL and conversions between those
forms.
> gdalsrsinfo -h
Usage: gdalsrsinfo [options] srs_def
srs_def may be the filename of a dataset from which to extract SRS information
OR any of the usual GDAL/OGR forms
(complete WKT, PROJ.4, EPSG:n or a file containing the SRS)
Options:
[--help-general] [-h] Show help and exit
[-p] Pretty-print where applicable (e.g. WKT)
[-s] Be as silent as possible
[-o out_type] Output type {all,proj4,wkt,esri,mapinfo,xml}
Please give me your opinion on this, and if I should go ahead and
commit it to svn trunk. Also what name it should have.
Attaching source code and modified GNUMakefile to build. It is written
in c to make it easily available to all GDAL installations.
Regards, Etienne
Posting some examples:
> ./gdalsrsinfo -o all landsat.tif
PROJ.4 : '+proj=utm +zone=19 +south +datum=WGS84 +units=m +no_defs '
OGC WKT :
PROJCS["WGS 84 / UTM zone 19S",GEOGCS["WGS
84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-69],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32719"]]
ESRI WKT :
PROJCS["WGS_1984_UTM_Zone_19S",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-69],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]]
MAPINFO : 'Earth Projection 8, 104, "m", -69, 0, 0.9996, 500000, 10000000'
> ./gdalsrsinfo -o proj4 "EPSG:32722"
PROJ.4 : '+proj=utm +zone=22 +south +datum=WGS84 +units=m +no_defs '
> ./gdalsrsinfo -o wkt -s "EPSG:32722"
PROJCS["WGS 84 / UTM zone 22S",GEOGCS["WGS
84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-51],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32722"]]
> ./gdalsrsinfo -o wkt -p "EPSG:4326"
OGC WKT :
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4326"]]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdalsrsinfo.c
Type: text/x-csrc
Size: 7991 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111016/c2ea8049/gdalsrsinfo.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GNUmakefile
Type: application/octet-stream
Size: 6271 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111016/c2ea8049/GNUmakefile.obj
More information about the gdal-dev
mailing list