[gdal-dev] Inconsistent handling of Lambert Conformal Conic
projection
Andrew Monteiro
amonteiro at dbxgeomatics.com
Thu Mar 10 10:31:34 EST 2011
Hi All,
I'm experiencing some inconsistent behavior with GDAL 1.8.0's projection
handling routines that I'd like to bring to someone's attention.
I'm playing with some maps in Lambert Conformal Conic, and the same
projection information is getting handled differently depending on how I
provide it to GDAL.
I started with a MapInfo coordinate system string:
Coordsys Earth Projection 3, 74, "m", -95, 49, 49, 77, 0, 0
When that's used, it will come back in Proj4 format as:
+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0
+ellps=GRS80 +towgs84=0,0,0,-0,-0,-0,0 +units=m +no_defs
However, if I start with the above Proj4 format string and ask for it
back, I get
+proj=lcc +lat_1=49 +lat_0=49 +lon_0=-95 +k_0=1 +x_0=0 +y_0=0
+ellps=GRS80 +datum=NAD83 +units=m +no_defs
You can see that the lat_2 parameter is no longer to be found...
After poking around in the source code, I've found a difference between
two routines that handle importing coordinate systems.
gdal-1.8.0\ogr\ogrsf_frmts\mitab\mitab_coordsys.cpp has code
/*--------------------------------------------------------------
* Lambert Conic Conformal
*-------------------------------------------------------------*/
case 3:
poSR->SetLCC( GetMIFParm( papszNextField, 2, 0.0 ),
GetMIFParm( papszNextField, 3, 0.0 ),
GetMIFParm( papszNextField, 1, 0.0 ),
GetMIFParm( papszNextField, 0, 0.0 ),
GetMIFParm( papszNextField, 4, 0.0 ),
GetMIFParm( papszNextField, 5, 0.0 ) );
break;
however, in \gdal-1.8.0\ogr\ogr_srs_proj4.cpp the code is:
else if( EQUAL(pszProj,"lcc") )
{
if( OSR_GDV(papszNV, "lat_0", 0.0 )
== OSR_GDV(papszNV, "lat_1", 0.0 ) )
{
/* 1SP form */
SetLCC1SP( OSR_GDV( papszNV, "lat_0", 0.0 ),
OSR_GDV( papszNV, "lon_0", 0.0 ),
OSR_GDV( papszNV, "k_0", 1.0 ),
OSR_GDV( papszNV, "x_0", 0.0 ),
OSR_GDV( papszNV, "y_0", 0.0 ) );
}
else
{
/* 2SP form */
SetLCC( OSR_GDV( papszNV, "lat_1", 0.0 ),
OSR_GDV( papszNV, "lat_2", 0.0 ),
OSR_GDV( papszNV, "lat_0", 0.0 ),
OSR_GDV( papszNV, "lon_0", 0.0 ),
OSR_GDV( papszNV, "x_0", 0.0 ),
OSR_GDV( papszNV, "y_0", 0.0 ) );
}
}
As far as I can figure, these are the two spots that are setting up the
internals for the coordinate system, and they're not quite doing it the
same.
I just don't know enough about the Lambert Conformal Conic coordinate
system any more to tell if I should tweak the MapInfo import routine or
the proj4 import routine.
So I thought I'd throw this out there and see what the experts had to
say.
Thanks,
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110310/d2108a5b/attachment-0001.html
More information about the gdal-dev
mailing list