[Gdal-dev] OGR Error on State Plane transform

Frank Warmerdam warmerdam at pobox.com
Fri May 30 14:39:21 EDT 2003


Garvan Keeley wrote:
> Hi Frank,
> the version of GDAL is from CVS, the last update was March 24. I'll pull the
> latest and rebuild.
> 
> I am using Windows, Visual C++.
> 
> The code:
> 
> 	OGRSpatialReference source;
> 	OGRSpatialReference destination;
> 	OGRCoordinateTransformation* transform;
> 
> 	source.SetWellKnownGeogCS("NAD83");
> 	destination.SetWellKnownGeogCS("NAD83"); 
> 	destination.SetStatePlane(101, true);
> 
> 	transform = OGRCreateCoordinateTransformation(&source,
> &destination);
> 	if (transform != NULL) {
> 		double x = -87.0, y = 30.5;
> 		OGRErr err = transform->Transform(1, &x, &y, NULL);
> 		if (err != OGRERR_NONE)
> 			TRACE("%s\n", CPLGetLastErrorMsg());
> 		
> 		TRACE("Transform Result: %f %f  \n", x, y);
> 		delete transform;    
> 	}


Garvan,

I have reproduced your problem.  The system isn't finding the stateplane.csv
file.  Try pointing GEOTIFF_CSV to your gdal/data directory, or copying
stateplane.csv (and likely pcs.csv and gcs.csv) to your GEOTIFF_CSV directory.

I have also improved the error message (the text of the message was out of
date), and a bug in the fallback code that uses SetLocalCS() if the state
plane zone can't be fully resolved.

Finally, I have just today made substantial other changes to SetStatePlane().
The C++ method now takes additional (optional) arguments to override the
linear units from what the legal (aka EPSG) definition of the zone is.  It
is common, for instance, to use NAD83 State Plane zone definitions, but to
force the units to feet.  Converting the meter definition to feet is a bit
tricky, but this is now all encapsulated in the SetStatePlane() method.

While this changes the C++ ABI, old code should still compile fine since
the extra arguments are defaulted.  I also added OSRSetStatePlaneWithUnits()
to the C API for the new args, and left the old call unchanged so there
is no C ABI change (just an extension).

The autotest suite now includes some state plane testing.

The Erdas Imagine driver now properly supports state plane files
where the units are not the same as the expected zone units.

A big day for state plane!

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    | Geospatial Programmer for Rent





More information about the Gdal-dev mailing list