[Gdal-dev] crash on blank lines in .prj / ESRI TM params

Frank Warmerdam fwarmerdam at gmail.com
Fri Feb 18 17:01:20 EST 2005


On Mon, 14 Feb 2005 22:36:24 -0500, Ben Discoe <ben at vterrain.org> wrote:
> I've cc'd GM's author, so he can address the extra LF characters, but it
> would also be good to make OGR a little more robust.  The problem appears to
> be an if/else in OSR_GDV (ogr_srs_esri.cpp) which doesn't check for an empty
> parameter.  The problem is probably in the calling code though
> (importFromESRI) which is making the assumption.

Ben,

I have committed a fix to ogr_srs_esri.cpp to deal gracefully 
with blank lines amoung the parameters. 

> Even when the extra LF are removed, there is a second problem: OGR is
> expecting the parameters for TM projections in this order:
> 1. Scale
> 2. CenterLat (latitude of the origin)
> 3. CenterLong (central meridian)
> 4. FalseEasting
> 5. FalseNorthing
> 
> But GM is writing them in a slightly different order:
> 1. Scale
> 2. CenterLong (central meridian)
> 3. CenterLat (latitude of the origin)
> 4. FalseEasting
> 5. FalseNorthing
> 
> It seems reasonable to conclude that one of these (OGR or GM) is
> wrong/non-standard.

Yikes! 

I haven't fixed this.  My understanding has been that the
comments are just advisory for human readers and that
there is a definitive order to the parameters.  In fact, I would 
swear I have seen .prj files without the comments.  I have one
such sample in my sample data tree but I'm not sure if it is
"correct". 

For the time being I'm not making any change in this regard
but it would be nice if Global Mapper output parameters in 
the same order as Arc/Info. 

Of course, we can all hope that these Arc/Info 7.x .prj files
will continue to fade out of use since their handling is at
best error prone in GDAL/OGR. 

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