[Gdal-dev] ESRI projection (prj) format problems
Frank Warmerdam
warmerdam at pobox.com
Mon Oct 25 16:28:41 EDT 2004
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