Opened 12 years ago

Closed 8 years ago

#3998 closed defect (duplicate)

Inconsistent import of LCC coordinate system via MapInfo & PROJ4 strings

Reported by: amonteiro3 Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SRS Version: 1.8.0
Severity: normal Keywords:
Cc:

Description

I posted this to the forum, but nobody has chosen to reply. So I thought I'd enter it as a bug.

I started with a MapInfo coordinate system string:

Coordsys Earth Projection 3, 74, “m”, -95, 49, 49, 77, 0, 0

When that’s used, GDAL 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.

Change History (2)

comment:1 by Even Rouault, 9 years ago

Linked tickets #3998, #4605 and #5191

comment:2 by Even Rouault, 8 years ago

Resolution: duplicate
Status: newclosed

I'd say the fix for #5191 fixed that one.

Note: See TracTickets for help on using tickets.