[gdal-dev] Easy way to tell if my image is EPSG 4326

Billy Newman newmanw10 at gmail.com
Thu Jul 12 14:27:42 PDT 2012


I am using java bindings to read in some metadata from image files.  I have
a check for images that are in EPSG:4326 (if not I warp them).  However I
have an image which I know is EPSG:4326 that has the following:
"GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG\","7030"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","4326"]]"

This is the constant from gdal I am using to compare:
org.gdal.osr.osrConstants.SRS_WKT_WGS84 =
"GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG\","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]]"

So obviously when I do a string  comparison the two strings do not match.

1. my file is marked wrong and I am hosed.  This is tough cause I have
thousands of these files.
2. There is a much better way to look at the images projection string to
determine that it is EPSG:4326 and not some other projection.  I also have
file that are in a Transverse Mercator projection and its projection string
contains "EPSG 4326", so I know that I cannot just check for that in the
projection string.

So in the end my question is this: how can I tell from the projection
string metadata that I get from a GDAL Dataset object (Java) if it is
EPSG:4326.

thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120712/7d8ef5c3/attachment.html>


More information about the gdal-dev mailing list