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

Chapman, Martin MChapman at sanz.com
Mon Feb 14 22:42:08 EST 2005


Ben,
 
That file doesn't look like an esri prj file.  Attached is what esri looks like.  I think the style is called something like baucus-nor or something.  It's similiar to an ogc wks.
 
Martin

	-----Original Message----- 
	From: Ben Discoe [mailto:ben at vterrain.org] 
	Sent: Mon 2/14/2005 8:36 PM 
	To: gdal-dev at remotesensing.org 
	Cc: support at globalmapper.com 
	Subject: [Gdal-dev] crash on blank lines in .prj / ESRI TM params
	
	


	I noticed this evening that OGR will crash if asked to parse an ESRI-style
	.prj file with some extra whitespace.  Attached is an example, which was
	output from the software 'Global Mapper' (GM).
	
	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.
	
	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.
	
	-Ben
	

-------------- next part --------------
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]]


More information about the Gdal-dev mailing list