[Gdal-dev] Problem reading projection information consistently

Ben Greene bgreene at rapidmap.com.au
Mon Jun 25 19:51:53 EDT 2007


I had a similar issue with an image that had invalid/confusing
projection information, but a valid EPSG code definition.  It seemed
that OpenEV extracted the EPSG code and used the definition for that to
generate the WKT, but GDAL was stricter with its interpretation.
I think that might be what's happening here.

I found this problem when trying to convert the WKT to proj4, which
returned an empty string.

What I ended up doing was, if the WKT didn't make any sense, parsing the
WKT looking for an EPSG code, and if I found one, I looked it up in the
'epsg' file which I believe is supplied with GDAL.
I then created the SpatialReference from the proj4 definition associated
with that EPSG code.

(I tried creating the SpatialReference directly from the EPSG code, but
it seems that my build of the C# bindings has issues with that, and
threw an exception).

HTH

Ben

-----Original Message-----
From: Luke Roth [mailto:roth.luke at gmail.com] 
Sent: Saturday, June 23, 2007 12:49 AM
To: gdal-dev at lists.maptools.org
Subject: [Gdal-dev] Problem reading projection information consistently

I'm having an issue reading the projection information from an Ikonos
image.  I know it to be UTM zone 17, and when I open it in OpenEV
(from FWTools 1.3.1) I get the WKT

PROJCS["WGS 84 / UTM zone 17N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.2572235630016]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-81],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1]]

This is what I would expect, but when I use gdalinfo or the API
command GetProjectionRef() (using GDAL from the same version of
FWTools) I get:

PROJCS["unnamed",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.2572235630016,
                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",-81],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32617"]]

Why is there a difference?  I'm trying to write a script to convert a
large number of images and shapefiles to a common projection, but this
is causing a problem.  Any ideas?  If I should be sending this to the
FWTools mailing list instead, let me know.

Thanks,

Luke Roth
_______________________________________________
Gdal-dev mailing list
Gdal-dev at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/gdal-dev




More information about the Gdal-dev mailing list