[FWTools] GDAL OGRSpatialReference::Validate()

Frank Warmerdam fwarmerdam at gmail.com
Wed May 4 10:25:18 EDT 2005


On 5/4/05, Martin Fix <Martin.Fix at ptv.de> wrote:
>  
> 
> Dear all, 
> 
> I'm having a bit trouble using the method
> OGRSpatialReference::Validate(). 
> 
> When I define a projection Mercator 
> 
> PROJCS["World_Mercator",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],PARAMETER["Standard_Parallel_1",0],UNIT["Meter",1]]
> 
> as it is the exact definition of ESRI, the validate method fails with the
> error code "OGR_CORRUPT_DATA". 

Martin, 

If you enable CPL debugging, the validate method will usually
report why it fails.  This can be accomplished by setting the CPL_DEBUG
environment variable to ON.  With it I get:

OGRSpatialReference::Validate: PARAMETER Standard_Parallel_1 for
PROJECTION Mercator_1SP is not permitted.

The SetMercator() method on OGRSpatialReference uses
"Latitude_Of_Origin" instead of "Standard_Parallel_1".  So, it seems
the problem is a deficiency in the morphFromESRI() method which 
needs to convert this parameter.  I have committed a fix to morphToESRI()
(and morphFromESRI()) to handle this parameter translation and then
the validate does pass. 

I will warn you that the Validate() is by no means comprehensive. 
 
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 FWTools mailing list