[Gdal-dev] SetStatePlane newbie question
Frank Warmerdam
warmerdam at pobox.com
Fri Mar 31 23:20:09 EST 2006
Mote, Kevin D wrote:
>
> I'm new to OGR/GDAL. I've been tasked with creating a simple module that
> will transform State Plane coordinates to lat/lon.
>
> This code is my first stab at it:
>
> #include <gdal.h>
> #include <gdal_priv.h>
> #include <ogr_api.h>
> #include <ogr_spatialref.h>
>
> //Perform our inverse conversion:
> OGRSpatialReference sourceSRS;
> OGRSpatialReference destinationSRS;
> OGRCoordinateTransformation* pTransform;
>
> OGRErr err;
> err = sourceSRS.SetStatePlane(3102, true);
...
> Problem: The SetStatePlane() call is returning an error code of 6
> (OGRERR_FAILURE).
> What am I doing wrong? (I'm sure there's a number of things!)
Kevin,
The code looks fine on quick inspection. I suspect there is a
problem finding the EPSG and other support files. The GDAL_DATA
environment is normally used to accomplish this and it should
point to the directory containing files like pcs.csv, and
stateplane.csv.
You can also set this within the code itself if you need to.
One way would be the CPLSetConfigOption("GDAL_DATA","/usr/local/share/gdal")
for instance.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGF, http://osgeo.org
More information about the Gdal-dev
mailing list