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

Chapman, Martin MChapman at sanz.com
Mon Oct 25 16:12:32 EDT 2004


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.

Thanks for your help,
Martin

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


Chapman, Martin wrote:
> All,
>  
> I am trying to use OGR to load some shape files with the following 
> esri
> projections (.prj).  As I understand it, OGR/Proj should be able to 
> convert the following projection names to the corresponding proj4 
> names.  I have used both the importFromWKT and importFromESRI
functions 
> but keep getting the error - "projection not named" error.  I have 
> attached some of the prj files.
>  
> 1.  North_America_Albers_Equal_Area_Conic - Albers
> 2.  Bonne - bonne
> 3.  North_America_Lambert_Conformal_Conic - Lambert_Conformal_Conic 4.

> World_Mercator - Mercator 5.  World_Van_der_Grinten_I - 
> Van_der_Grinten_I

Martin,

I tried the Bonne, Van der Grinten and Mercator .prj files (it seems
those there the only ones in the zip file) and the VDG and Mercator ones
seemed to work OK for me.

For instance:

   testepsg ESRI::Mercator\ \(world\).prj
   ...
   PROJ.4 rendering of [ESRI::Mercator (world).prj] = +proj=merc
+lat_ts=0
   +lon_0=0 +k=1.000000 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m
+no_defs

The Bonne does not translate, and I don't know what the equilvelent
PROJ.4 string would be.  I don't recognise this projection.

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