Created
May 13, 2013 17:21
-
-
Save vpicavet/5569914 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ogr/ogrsf_frmts/mitab/mitab_mapheaderblock.cpp b/ogr/ogrsf_frmts/mitab/mitab_mapheaderblock.cpp | |
index b8a53bd..155684b 100644 | |
--- a/ogr/ogrsf_frmts/mitab/mitab_mapheaderblock.cpp | |
+++ b/ogr/ogrsf_frmts/mitab/mitab_mapheaderblock.cpp | |
@@ -862,7 +862,27 @@ int TABMAPHeaderBlock::CommitToFile() | |
WriteDouble(m_YDispl); | |
for(i=0; i<6; i++) | |
- WriteDouble(m_sProj.adProjParams[i]); | |
+ { | |
+ if( m_sProj.nProjId == 3 | |
+ && m_sProj.nDatumId == 33 | |
+ && m_sProj.nEllipsoidId == 0 | |
+ && m_sProj.adProjParams[3] == 44.0 | |
+ && m_sProj.adProjParams[2] == 49.0) | |
+ { | |
+ // Swap standard parallel 1 and 2 when writing epsg:2154 L93 | |
+ // (MapInfo save and read these parameters in reverse order | |
+ // compared to spec) | |
+ if (i==2) | |
+ WriteDouble(m_sProj.adProjParams[3]); | |
+ else if (i==3) | |
+ WriteDouble(m_sProj.adProjParams[2]); | |
+ else | |
+ WriteDouble(m_sProj.adProjParams[i]); | |
+ } | |
+ else | |
+ WriteDouble(m_sProj.adProjParams[i]); | |
+ | |
+ } | |
WriteDouble(m_sProj.dDatumShiftX); | |
WriteDouble(m_sProj.dDatumShiftY); | |
diff --git a/ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp b/ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp | |
index bc6939a..5a942ef 100644 | |
--- a/ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp | |
+++ b/ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp | |
@@ -258,6 +258,7 @@ MapInfoDatumInfo asDatumInfoList[] = | |
{ 6272, 31, "New_Zealand_GD49", 4, 84, -22, 209, 0, 0, 0, 0, 0}, | |
{ 6272, 31, "New_Zealand_Geodetic_Datum_1949",4,84, -22, 209, 0, 0, 0, 0, 0}, | |
{ 0, 32, "GRS_67", 21,0, 0, 0, 0, 0, 0, 0, 0}, | |
+{ 6171, 33, "Reseau_Geodesique_Francais_1993",0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
{ 0, 33, "GRS_80", 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
{ 6675, 34, "Guam_1963", 7, -100, -248, 259, 0, 0, 0, 0, 0}, | |
{ 0, 35, "Gux_1_Astro", 4, 252, -209, -751,0, 0, 0, 0, 0}, | |
@@ -638,12 +639,29 @@ OGRSpatialReference *TABFile::GetSpatialRef() | |
* Lambert Conic Conformal | |
*-------------------------------------------------------------*/ | |
case 3: | |
- m_poSpatialRef->SetLCC( sTABProj.adProjParams[2], | |
- sTABProj.adProjParams[3], | |
- sTABProj.adProjParams[1], | |
- sTABProj.adProjParams[0], | |
- sTABProj.adProjParams[4], | |
- sTABProj.adProjParams[5] ); | |
+ if( sTABProj.nProjId == 3 | |
+ && sTABProj.nDatumId == 33 | |
+ && sTABProj.nEllipsoidId == 0 | |
+ && sTABProj.adProjParams[3] == 49.0 | |
+ && sTABProj.adProjParams[2] == 44.0) | |
+ { | |
+ // Swap SP1 and SP2 if in EPSG:2154 (L93) | |
+ // (MapInfo save and read these parameters in reverse order | |
+ // compared to spec) | |
+ m_poSpatialRef->SetLCC( sTABProj.adProjParams[3], | |
+ sTABProj.adProjParams[2], | |
+ sTABProj.adProjParams[1], | |
+ sTABProj.adProjParams[0], | |
+ sTABProj.adProjParams[4], | |
+ sTABProj.adProjParams[5] ); | |
+ } | |
+ else | |
+ m_poSpatialRef->SetLCC( sTABProj.adProjParams[2], | |
+ sTABProj.adProjParams[3], | |
+ sTABProj.adProjParams[1], | |
+ sTABProj.adProjParams[0], | |
+ sTABProj.adProjParams[4], | |
+ sTABProj.adProjParams[5] ); | |
break; | |
/*-------------------------------------------------------------- | |
@@ -1081,6 +1099,14 @@ OGRSpatialReference *TABFile::GetSpatialRef() | |
m_poSpatialRef->SetExtension( "PROJCS", "PROJ4", "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs" ); | |
} | |
+ if( sTABProj.nProjId == 3 | |
+ && sTABProj.nDatumId == 33 | |
+ && sTABProj.nEllipsoidId == 0) | |
+ { | |
+ m_poSpatialRef->SetNode( "PROJCS", "RGF93 / Lambert-93" ); | |
+ m_poSpatialRef->SetNode( "PROJCS|GEOGCS", "RGF93"); | |
+ } | |
+ | |
return m_poSpatialRef; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment