[Gdal-dev] ESRI projection (prj) format problems

Chapman, Martin MChapman at sanz.com
Mon Oct 25 16:30:07 EDT 2004


Frank,

Ok, thanks again.  I will try to use testepsg to figure it out and I'll
submit the bug for bonne into bugzilla.  

Martin

-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com] 
Sent: Monday, October 25, 2004 2:29 PM
To: Chapman, Martin
Cc: gdal-dev at remotesensing.org
Subject: Re: [Gdal-dev] ESRI projection (prj) format problems


Chapman, Martin wrote:
> Frank,
> 
> What version of gdal/ogr/proj4 are you using when doing the test (I am

> using the latest of all three)?  I used the following code (source is 
> a latlong projection and target is the mercator projection):
> 
> err = m_pOGRSourceSRS->importFromESRI(pszSourceWks);
> if (err != OGRERR_NONE) throw (char*) CPLGetLastErrorMsg();
> 
> err = m_pOGRTargetSRS->importFromESRI(pszTargetWks);
> if (err != OGRERR_NONE) throw (char*) CPLGetLastErrorMsg();
> 
> m_pCT = OGRCreateCoordinateTransformation(m_pOGRSourceSRS,
> m_pOGRTargetSRS);
> if (!m_pCT)
> 	throw (char*) CPLGetLastErrorMsg();
> 
> OGRCreateCoordinateTransformation always returns null and
> CPLGetLastErrorMsg() returns:
> "Failed to initialize PROJ.4 with `+ellps=WGS84 +units=m +no_defs '."
> 
> If I hard code the proj4 mercator string it works ok.  It appears as 
> though the OGR parser is having problems parsing the mercator 
> projection string (ESRI).  As far as Bonne goes, I found it in the 
> Proj4 docs.  The name of the projection is "bonne".  How do I get the 
> testepsg.cpp code to build when I build gdal?  I will test it using 
> that code and see what I get.


Martin,

To build testepsg, just cd into gdal/ogr after a regular build, and do:

   make testepsg

I took an existing shapefile and use your Mercator and VDG .prj files
with it, and did an ogr2ogr -t_srs WGS84 translation on them.  That
worked, though it is hard for me to know if the results are correct.

For the Bonne, if you submit a bug report in the GDAL/OGR Bugzilla
(include the .prj file since I have deleted it) along with a any
reference point reprojected from Bonne to lat/long that you can find,
and I will add Bonne support to GDAL/OGR using the ESRI WKT formulation.

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