<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:10.0pt;
        margin-left:0cm;
        line-height:115%;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi All,<o:p></o:p></p><p class=MsoNormal>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. <o:p></o:p></p><p class=MsoNormal>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.<o:p></o:p></p><p class=MsoNormal>I started with a MapInfo coordinate system string:<o:p></o:p></p><p class=MsoNormal>Coordsys Earth Projection 3, 74, “m”, -95, 49, 49, 77, 0, 0<o:p></o:p></p><p class=MsoNormal>When that’s used, it will come back in Proj4 format as:<o:p></o:p></p><p class=MsoNormal><span style='font-size:9.0pt;line-height:115%;font-family:"Verdana","sans-serif"'>+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<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;line-height:115%;font-family:"Verdana","sans-serif"'>However, if I start with the above Proj4 format string and ask for it back, I get<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal'><span style='font-size:10.0pt;font-family:"Courier New"'>+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 <o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>You can see that the lat_2 parameter is no longer to be found…<o:p></o:p></p><p class=MsoNormal>After poking around in the source code, I’ve found a difference between two routines that handle importing coordinate systems.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>gdal-1.8.0\ogr\ogrsf_frmts\mitab\mitab_coordsys.cpp has code<o:p></o:p></p><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:green'>/*--------------------------------------------------------------</span><span style='font-size:12.0pt;font-family:Consolas;color:black'><o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:green'> * Lambert Conic Conformal</span><span style='font-size:12.0pt;font-family:Consolas;color:black'><o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:green'> *-------------------------------------------------------------*/</span><span style='font-size:12.0pt;font-family:Consolas;color:black'><o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:blue'>case</span><span style='font-size:12.0pt;font-family:Consolas;color:black'> 3:<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> poSR->SetLCC( GetMIFParm( papszNextField, 2, 0.0 ),<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> GetMIFParm( papszNextField, 3, 0.0 ),<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> GetMIFParm( papszNextField, 1, 0.0 ),<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> GetMIFParm( papszNextField, 0, 0.0 ),<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> GetMIFParm( papszNextField, 4, 0.0 ),<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> GetMIFParm( papszNextField, 5, 0.0 ) );<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> </span><span style='font-size:12.0pt;font-family:Consolas;color:blue'>break</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>;<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'><o:p> </o:p></span></pre><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>however, in \gdal-1.8.0\ogr\ogr_srs_proj4.cpp the code is:<o:p></o:p></p><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> </span><span style='font-size:12.0pt;font-family:Consolas;color:blue'>else</span><span style='font-size:12.0pt;font-family:Consolas;color:black'> </span><span style='font-size:12.0pt;font-family:Consolas;color:blue'>if</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>( EQUAL(pszProj,</span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"lcc"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>) ) <o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> {<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> </span><span style='font-size:12.0pt;font-family:Consolas;color:blue'>if</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>( OSR_GDV(papszNV, </span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"lat_0"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>, 0.0 ) <o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> == OSR_GDV(papszNV, </span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"lat_1"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>, 0.0 ) )<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> {<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> </span><span style='font-size:12.0pt;font-family:Consolas;color:green'>/* 1SP form */</span><span style='font-size:12.0pt;font-family:Consolas;color:black'><o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> SetLCC1SP( OSR_GDV( papszNV, </span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"lat_0"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>, 0.0 ), <o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> OSR_GDV( papszNV, </span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"lon_0"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>, 0.0 ), <o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> OSR_GDV( papszNV, </span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"k_0"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>, 1.0 ), <o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> OSR_GDV( papszNV, </span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"x_0"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>, 0.0 ), <o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> OSR_GDV( papszNV, </span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"y_0"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>, 0.0 ) );<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> }<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> </span><span style='font-size:12.0pt;font-family:Consolas;color:blue'>else</span><span style='font-size:12.0pt;font-family:Consolas;color:black'><o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> {<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> </span><span style='font-size:12.0pt;font-family:Consolas;color:green'>/* 2SP form */</span><span style='font-size:12.0pt;font-family:Consolas;color:black'><o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> SetLCC( OSR_GDV( papszNV, </span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"lat_1"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>, 0.0 ), <o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> OSR_GDV( papszNV, </span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"lat_2"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>, 0.0 ), <o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> OSR_GDV( papszNV, </span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"lat_0"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>, 0.0 ), <o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> OSR_GDV( papszNV, </span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"lon_0"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>, 0.0 ), <o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> OSR_GDV( papszNV, </span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"x_0"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>, 0.0 ), <o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> OSR_GDV( papszNV, </span><span style='font-size:12.0pt;font-family:Consolas;color:#A31515'>"y_0"</span><span style='font-size:12.0pt;font-family:Consolas;color:black'>, 0.0 ) );<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> }<o:p></o:p></span></pre><pre style='background:white'><span style='font-size:12.0pt;font-family:Consolas;color:black'> }<o:p></o:p></span></pre><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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.<o:p></o:p></p><p class=MsoNormal>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.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So I thought I’d throw this out there and see what the experts had to say.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks,<o:p></o:p></p><p class=MsoNormal>Andy<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>