118 if( Definition && *Definition)
136 if( Definition && *Definition )
164 m_Name =
WKT.Get_Property(
"NAME");
if( m_Name.is_Empty() ) { m_Name =
"unnamed"; }
166 if( !
WKT(
"ID") || !
WKT[
"ID"].Get_Content(
"VAL1", m_Code) || !
WKT[
"ID"].Get_Property(
"NAME", m_Authority) )
170 if( Tokens.
Get_Count() == 2 && !Tokens[0].is_Empty() && Tokens[1].asInt(m_Code) )
172 m_Authority = Tokens[0]; m_Authority.Make_Upper();
176 m_Authority.Clear(); m_Code = -1;
213 if(
PROJ.is_Empty() )
224 m_Name =
WKT.Get_Property(
"NAME");
if( m_Name.is_Empty() ) { m_Name =
"unnamed"; }
226 if( !
WKT(
"ID") || !
WKT[
"ID"].Get_Content(
"VAL1", m_Code) || !
WKT[
"ID"].Get_Property(
"NAME", m_Authority) )
228 m_Authority.Clear(); m_Code = -1;
237 m_Name =
_TL(
"undefined");
238 m_Type = ESG_CRS_Type ::Undefined;
243 m_Authority .Clear();
257 return(
Load(Stream) );
267 return(
Save(Stream, Format) );
306 case ESG_CRS_Format::CODE:
if( !m_Authority.is_Empty() && m_Code > 0 ) { Definition.
Printf(
"%s:%d", m_Authority.c_str(), m_Code); }
break;
343 Projection.Add_Child(
"CODE", m_Code)->Add_Property(
"authority", m_Authority);
374 return( CSG_Projections::_WKT2_to_MetaData(m_WKT2,
false).asText(1) );
387 return(
_TL(
"Unknown Spatial Reference") );
394 if( !m_Name.is_Empty() && m_Name.CmpNoCase(
"<custom>") )
399 if( m_Code > 0 && !m_Authority.is_Empty() )
408 #define ADD_HEAD(name, value) { CSG_String n(name), v(value); n.Replace("_", " "); v.Replace("_", " "); s += CSG_String::Format("<tr><th>%s</th><th>%s</th></tr>", n.c_str(), v.c_str()); }
409 #define ADD_INFO(name, value) { CSG_String n(name), v(value); n.Replace("_", " "); v.Replace("_", " "); s += CSG_String::Format("<tr><td>%s</td><td>%s</td></tr>", n.c_str(), v.c_str()); }
410 #define ADD_CONT(name, entry) if( entry ) { ADD_INFO(name, entry->Get_Content() ); }
411 #define ADD_PROP(name, entry, prop) if( entry && entry->Get_Property(prop) ) { ADD_INFO(name, entry->Get_Property(prop)); }
422 ADD_PROP(
_TL(
"Projection" ), PRJ(
"CONVERSION.METHOD"),
"NAME");
424 if( m_Code > 0 && !m_Authority.is_Empty() )
430 ADD_PROP(
_TL(
"Linear Unit" ), PRJ(
"UNIT"),
"NAME");
432 if( PRJ(
"CONVERSION") )
438 if( Parameter.
Cmp_Name(
"PARAMETER") && Parameter(
"VAL1") )
447 pGCS = PRJ(
"BASEGEODCRS");
451 pGCS =
WKT .Cmp_Name(
"GEOGCRS") ||
WKT .Cmp_Name(
"GEODCRS") ? &
WKT
452 :
WKT[0].Cmp_Name(
"GEOGCRS") ||
WKT[0].Cmp_Name(
"GEODCRS") ? &
WKT[0] : &
WKT[0][0];
462 ADD_PROP(
_TL(
"Prime Meridian" ), GCS(
"PRIMEM" ),
"NAME");
463 ADD_PROP(
_TL(
"Angular Unit" ), GCS(
"PRIMEM.LENGTHUNIT"),
"NAME");
465 ADD_PROP(
_TL(
"Spheroid" ), GCS(
"DATUM.ELLIPSOID" ),
"NAME");
466 ADD_CONT(
_TL(
"Semimajor Axis" ), GCS(
"DATUM.ELLIPSOID.VAL1"));
467 ADD_CONT(
_TL(
"Inverse Flattening" ), GCS(
"DATUM.ELLIPSOID.VAL2"));
468 ADD_CONT(
_TL(
"Extension" ), GCS(
"DATUM.EXTENSION" ));
470 if(
WKT(
"ABRIDGEDTRANSFORMATION") )
480 if( Parameter.
Cmp_Name(
"PARAMETER") && Parameter(
"VAL1") )
513 if( !m_Authority.is_Empty() && !m_Authority.CmpNoCase(
Projection.m_Authority) && m_Code ==
Projection.m_Code )
526 #define CMP_CONTENT(a, b ) (a && b && a->Cmp_Content(b->Get_Content()))
527 #define CMP_PROPERTY(a, b, p) (a && b && a->Get_Property(p) && b->Cmp_Property(p, a->Get_Property(p), true))
528 #define CMP_PARAMETER(a, b ) (a && b && ((!a->Cmp_Name("PARAMETER") && !b->Cmp_Name("PARAMETER")) || (CMP_PROPERTY(a, b, "name") && a->Cmp_Content(b->Get_Content()))))
531 CSG_Projections::_WKT1_to_MetaData(
Get_WKT1()),
532 CSG_Projections::_WKT1_to_MetaData(
Projection.Get_WKT1())
533 }, *pGCS[2] = { NULL, NULL };
538 if( !
CMP_CONTENT (
WKT[0](
"PROJECTION"),
WKT[1](
"PROJECTION") ) ) {
return(
false ); }
541 for(
int i=0; i<
WKT[0].Get_Children_Count() && i<
WKT[1].Get_Children_Count(); i++)
546 pGCS[0] =
WKT[0](
"GEOGCS");
547 pGCS[1] =
WKT[1](
"GEOGCS");
555 if( !pGCS[0] || !pGCS[1] )
560 if( !
CMP_CONTENT((*pGCS[0])(
"PRIMEM" ), (*pGCS[1])(
"PRIMEM" )) ) {
return(
false ); }
561 if( !
CMP_CONTENT((*pGCS[0])(
"UNIT" ), (*pGCS[1])(
"UNIT" )) ) {
return(
false ); }
562 if( !
CMP_CONTENT((*pGCS[0])(
"DATUM.SPHEROID.a" ), (*pGCS[1])(
"DATUM.SPHEROID.a" )) ) {
return(
false ); }
563 if( !
CMP_CONTENT((*pGCS[0])(
"DATUM.SPHEROID.rf"), (*pGCS[1])(
"DATUM.SPHEROID.rf")) ) {
return(
false ); }
565 if( (*pGCS[0])(
"DATUM.TOWGS84") || (*pGCS[1])(
"DATUM.TOWGS84") )
567 #define CMP_TOWGS84(id) (\
568 ((*pGCS[0])("DATUM.TOWGS84." id) ? (*pGCS[0])["DATUM.TOWGS84." id].Get_Content().asDouble() : 0.)\
569 == ((*pGCS[1])("DATUM.TOWGS84." id) ? (*pGCS[1])["DATUM.TOWGS84." id].Get_Content().asDouble() : 0.) )
580 if( (*pGCS[0])(
"DATUM.EXTENSION") || (*pGCS[1])(
"DATUM.EXTENSION") )
582 if( !
CMP_CONTENT((*pGCS[0])(
"DATUM.EXTENSION"), (*pGCS[1])(
"DATUM.EXTENSION")) ) {
return(
false ); }
647 m_Authority =
"EPSG";
649 m_PROJ =
"+proj=longlat +datum=WGS84 +no_defs";
651 "GEODCRS[\"WGS 84\","
652 " DATUM[\"World Geodetic System 1984\","
653 " ELLIPSOID[\"WGS 84\",6378137,298.257223563]],"
654 " CS[ellipsoidal,2],"
655 " AXIS[\"geodetic latitude (Lat)\",north],"
656 " AXIS[\"geodetic longitude (Lon)\",east],"
657 " UNIT[\"degree\",0.0174532925199433],"
658 " SCOPE[\"Horizontal component of 3D system.\"],"
660 " BBOX[-90,-180,90,180],"
661 " ID[\"EPSG\",4326]]";
698 if( Zone < 1 || Zone > 60 )
703 int EPSG_ID = (bSouth ? 32700 : 32600) + Zone;
712 "PROJCRS[\"WGS 84 / UTM zone %d%c\","
713 " BASEGEODCRS[\"WGS 84\","
714 " DATUM[\"World Geodetic System 1984\","
715 " ELLIPSOID[\"WGS 84\",6378137,298.257223563,"
716 " LENGTHUNIT[\"metre\",1]]],"
717 " PRIMEM[\"Greenwich\",0,"
718 " ANGLEUNIT[\"degree\",0.0174532925199433]]],"
719 " CONVERSION[\"UTM zone 32N\","
720 " METHOD[\"Transverse Mercator\","
721 " ID[\"EPSG\",9807]],"
722 " PARAMETER[\"Latitude of natural origin\",0,"
723 " ANGLEUNIT[\"degree\",0.0174532925199433],"
724 " ID[\"EPSG\",8801]],"
725 " PARAMETER[\"Longitude of natural origin\",%d,"
726 " ANGLEUNIT[\"degree\",0.0174532925199433],"
727 " ID[\"EPSG\",8802]],"
728 " PARAMETER[\"Scale factor at natural origin\",0.9996,"
729 " SCALEUNIT[\"unity\",1],"
730 " ID[\"EPSG\",8805]],"
731 " PARAMETER[\"False easting\",500000,"
732 " LENGTHUNIT[\"metre\",1],"
733 " ID[\"EPSG\",8806]],"
734 " PARAMETER[\"False northing\",%d,"
735 " LENGTHUNIT[\"metre\",1],"
736 " ID[\"EPSG\",8807]]],"
738 " AXIS[\"(E)\",east,"
740 " LENGTHUNIT[\"metre\",1]],"
741 " AXIS[\"(N)\",north,"
743 " LENGTHUNIT[\"metre\",1]],"
744 " ID[\"EPSG\",32632]]",
745 Zone, bSouth ?
'S' :
'N', 6 * (Zone - 1) - 177, bSouth ? 10000000 : 0, EPSG_ID
793 #if defined(__WXMAC__)
798 Path_Shared = SHARE_PATH;
801 #elif defined(_SAGA_LINUX)
803 Path_Shared = SHARE_PATH;
814 if( _Load(m_pPreferences,
SG_File_Make_Path(Path_Shared,
"saga_preferences",
"srs")) )
823void CSG_Projections::_On_Construction(
void)
833 m_pPreferences =
new CSG_Table(m_pProjections);
843 delete(m_pProjections);
844 delete(m_pPreferences);
850 if( m_pProjections ) { m_pProjections->Del_Records(); }
851 if( m_pPreferences ) { m_pPreferences->Del_Records(); }
862 return( m_pProjections->Get_Count() );
922 return( _Get_Projection(m_pProjections->Get_Record(Index)) );
928 CSG_String Authority(_Authority && *_Authority ? _Authority :
SG_T(
"EPSG"));
930 for(
sLong i=0; i<m_pProjections->Get_Count(); i++)
946 CSG_String Authority(_Authority && *_Authority ? _Authority :
SG_T(
"EPSG"));
948 for(
sLong i=0; i<m_pProjections->Get_Count(); i++)
969bool CSG_Projections::_Add_Preferences(
void)
971 if( !m_pProjections || !m_pPreferences || m_pPreferences->
Get_Count() < 1 )
979 for(
sLong iPreference=0, iProjection=0; iPreference<m_pPreferences->Get_Count() && iProjection<m_pProjections->
Get_Count(); )
981 CSG_Table_Record *pPreference = m_pPreferences->Get_Record_byIndex(iPreference);
982 CSG_Table_Record *pProjection = m_pProjections->Get_Record_byIndex(iProjection);
988 if( Comparison < 0 ) { iProjection++; }
else if( Comparison > 0 ) { iPreference++; }
else
992 if( Comparison < 0 ) { iProjection++; }
else if( Comparison > 0 ) { iPreference++; }
else
997 m_pPreferences->Select(pPreference,
true);
999 iProjection++; iPreference++;
1004 m_pProjections->Del_Index();
1005 m_pPreferences->Del_Index();
1007 if( m_pPreferences->Get_Selection_Count() < m_pPreferences->Get_Count() )
1009 for(
sLong iPreference=0; iPreference<m_pPreferences->Get_Count(); iPreference++)
1011 CSG_Table_Record *pPreference = m_pPreferences->Get_Record(iPreference);
1015 m_pProjections->Add_Record(pPreference);
1020 m_pPreferences->Select();
1028 for(
sLong i=0; i<m_pPreferences->Get_Count(); i++)
1040 if( m_bUseInternalDB )
1042 for(
sLong i=0; i<m_pProjections->Get_Count(); i++)
1061 int i = Authority_Code.
Find(
':');
1063 if( i > 1 && i < (
int)Authority_Code.
Length() - 2 )
1120 return( _Load(m_pProjections, File, bAppend) );
1126 return( m_pProjections->Save(File) );
1242 WKT.Get_Property(
"authority_name", Authority);
1243 WKT.Get_Property(
"authority_code", Code);
1246 if( !Authority.
is_Empty() && Code > 0 )
1303 for(
int i=0; i<m_pProjections->Get_Count(); i++)
1309 if(
WKT.Length() == 0 )
1318 WKT =
WKT.AfterFirst(
'[');
1327 Projection.Set_Value(0,
WKT.AfterFirst(
'\"').BeforeFirst(
'\"'));
1343 for(
int i=0; i<Projections.
Get_Count(); i++)
1348 Projections[i].asString(1),
1349 Projections[i].asInt (2),
1350 Projections[i].asString(3),
1351 Projections[i].asString(0)
1357 Projections[i].asString(1),
1358 Projections[i].asInt (2),
1359 Projections[i].asString(0)
1375 if(
WKT.is_Empty() )
1380 int Colon = -1, Bracket = -1;
1382 for(
int i=0, bracket=0, quota=0; Colon<0 && i<(int)
WKT.Length(); i++)
1387 bracket++;
if( bracket == 1 ) { Bracket = i; }
1391 bracket--;
if( bracket < 0 ) {
return(
false ); }
1397 quota = quota ? 0 : 1;
1402 if( bracket == 0 && quota == 0 )
1410 CSG_String Value = Colon < 0 ?
WKT :
WKT.Left(Colon);
1416 if( Value.
Find(
'\"') == 0 )
1429 CSG_String Key(Value.
Left(Bracket)); Key.Trim_Both();
1431 CSG_String Content(Value.
AfterFirst(
'[').
BeforeLast(
']')); Content.Trim_Both(); Content.Replace(
"\n",
"");
1433 _WKT2_to_MetaData(*MetaData.
Add_Child(Key), Content);
1438 _WKT2_to_MetaData(MetaData,
WKT.Right(
WKT.Length() - Colon - 1));
1447 CSG_MetaData MetaData; _WKT2_to_MetaData(MetaData,
WKT);
1451 CSG_MetaData *pMetaData = MetaData.
Get_Child(0);
1465 return( *pMetaData );
1478 if( !
WKT.is_Empty() )
1480 XML = _WKT2_to_MetaData(
WKT,
false).asText(1);
1496 for(
int i=0, l=-1; l!=0 && i<(int)
WKT.Length(); i++)
1502 default : Key +=
WKT[i];
break;
1504 case '[':
case '(': l = 1 ;
break;
1505 case ')':
case ']':
return(
false );
1514 default : bAdd =
true;
break;
1515 case '\"' : bAdd =
false;
break;
1516 case '[' :
case '(': bAdd = ++l > 1;
break;
1517 case ']' :
case ')': bAdd = l-- > 1;
break;
1518 case ',' :
if( !(bAdd = l > 1) ) Content.
Add(
"");
break;
1528 if( Key.
is_Empty() || Content[0].is_Empty() )
1534 if( !Key.
Cmp(
"AUTHORITY") && Content.
Get_Count() == 2 )
1542 CSG_MetaData *pKey = MetaData.
Add_Child(Key);
1555 || (!Key.
Cmp(
"PARAMETER" ) && Content.
Get_Count() >= 2) )
1562 if( (!Key.
Cmp(
"SPHEROID" ) && Content.
Get_Count() >= 3) )
1569 if( (!Key.
Cmp(
"TOWGS84" ) && Content.
Get_Count() >= 7) )
1580 if( (!Key.
Cmp(
"EXTENSION" ) && Content.
Get_Count() >= 2) )
1586 if( (!Key.
Cmp(
"PROJECTION") && Content.
Get_Count() >= 1) )
1592 for(
int i=0; i<Content.
Get_Count(); i++)
1594 _WKT1_to_MetaData(*pKey, Content[i]);
1603 CSG_MetaData MetaData;
1605 _WKT1_to_MetaData(MetaData,
WKT);
1630 if(
WKT.Cmp_Property(
"name",
"WGS84") )
1632 Proj4 +=
" +datum=WGS84";
1639 if( !
WKT(
"SPHEROID") ||
WKT[
"SPHEROID"].Get_Children_Count() != 2
1640 || !
WKT[
"SPHEROID"][0].Get_Content().asDouble(a) || a <= 0.
1641 || !
WKT[
"SPHEROID"][1].Get_Content().asDouble(b) || b < 0. )
1646 b = b > 0. ? a - a / b : a;
1651 if(
WKT(
"TOWGS84") &&
WKT[
"TOWGS84"].Get_Children_Count() == 7 )
1653 Proj4 +=
" +towgs84=";
1655 for(
int i=0; i<7; i++)
1662 Proj4 +=
WKT[
"TOWGS84"][i].Get_Content();
1674 CSG_MetaData m = _WKT1_to_MetaData(
WKT);
1682 int Authority_Code; CSG_String Authority_Name;
1711 if( !m(
"DATUM") || !_WKT1_to_Proj4_Set_Datum(Proj4, m[
"DATUM"]) )
1716 if( m(
"PRIMEM") && m[
"PRIMEM"].Get_Content().asDouble(d) && d != 0. )
1735 Proj4 =
"+proj=longlat";
1737 if( !m(
"DATUM") || !_WKT1_to_Proj4_Set_Datum(Proj4, m[
"DATUM"]) )
1742 if( m(
"PRIMEM") && m[
"PRIMEM"].Get_Content().asDouble(d) && d != 0. )
1760 if( m.
Cmp_Name(
"PROJCS") && m(
"GEOGCS") && m(
"PROJECTION") && m_WKT1_to_Proj4.Get_Translation(m[
"PROJECTION"].Get_Content(), Proj4) )
1762 if( m[
"PROJECTION"].Cmp_Content(
"Transverse_Mercator") )
1764 double Scale = -1., Easting = -1., Northing = -1., Meridian = -1., Latitude = -1.;
1768 if( m[i].Cmp_Name(
"PARAMETER") )
1772 if( m[i].Cmp_Property(
"name",
"central_meridian" ,
true) && m[i].Get_Content().asDouble(v) ) Meridian = v;
1773 if( m[i].Cmp_Property(
"name",
"latitude_of_origin",
true) && m[i].Get_Content().asDouble(v) ) Latitude = v;
1774 if( m[i].Cmp_Property(
"name",
"scale_factor" ,
true) && m[i].Get_Content().asDouble(v) ) Scale = v;
1775 if( m[i].Cmp_Property(
"name",
"false_easting" ,
true) && m[i].Get_Content().asDouble(v) ) Easting = v;
1776 if( m[i].Cmp_Property(
"name",
"false_northing" ,
true) && m[i].Get_Content().asDouble(v) ) Northing = v;
1780 if( Latitude == 0. && Scale == 0.9996 && Easting == 500000. && (Northing == 0. || Northing == 10000000.) )
1782 Proj4 =
"+proj=utm";
1784 if( !m[
"GEOGCS"](
"DATUM") || !_WKT1_to_Proj4_Set_Datum(Proj4, m[
"GEOGCS"][
"DATUM"]) )
1791 if( Northing == 10000000. )
1803 Proj4 =
"+proj=" + Proj4;
1805 if( !m[
"GEOGCS"](
"DATUM") || !_WKT1_to_Proj4_Set_Datum(Proj4, m[
"GEOGCS"][
"DATUM"]) )
1810 if( m(
"PRIMEM") && m[
"PRIMEM"].Get_Content().asDouble(d) && d != 0. )
1817 if( m[i].Cmp_Name(
"PARAMETER") )
1819 CSG_String Parameter;
1821 if( m_WKT1_to_Proj4.Get_Translation(m[i].Get_Property(
"name"), Parameter) )
1823 Proj4 +=
" +" + Parameter +
"=" + m[i].
Get_Content();
1832 if( m(
"UNIT") && m[
"UNIT"].Get_Content().asDouble(d) && d != 0. && d != 1. )
1854 return( Proj4.
Find(
"+" + Key) >= 0 );
1862 int l, i = Proj4.
Find(
"+" + Key +
"=");
1866 for(++i, l=0; l<2 && i<(int)Proj4.
Length(); i++)
1870 case '=': l++;
break;
1871 case '+': l=2;
break;
1872 case ' ': l=2;
break;
1882 return( Value.
Length() > 0 );
1888 const char ellipsoid[42][2][32] =
1890 {
"MERIT" ,
"6378137.0,298.257" },
1891 {
"SGS85" ,
"6378136.0,298.257" },
1892 {
"GRS80" ,
"6378137.0,298.2572221" },
1893 {
"IAU76" ,
"6378140.0,298.257" },
1894 {
"airy" ,
"6377563.396,299.3249753" },
1895 {
"APL4.9" ,
"6378137.0,298.25" },
1896 {
"NWL9D" ,
"6378145.0,298.25" },
1897 {
"mod_airy" ,
"6377340.189,299.3249374" },
1898 {
"andrae" ,
"6377104.43,300" },
1899 {
"aust_SA" ,
"6378160.0,298.25" },
1900 {
"GRS67" ,
"6378160.0,298.2471674" },
1901 {
"bessel" ,
"6377397.155,299.1528128" },
1902 {
"bess_nam" ,
"6377483.865,299.1528128" },
1903 {
"clrk66" ,
"6378206.4,294.9786982" },
1904 {
"clrk80" ,
"6378249.145,293.4663" },
1905 {
"CPM" ,
"6375738.7,334.29" },
1906 {
"delmbr" ,
"6376428.0,311.5" },
1907 {
"engelis" ,
"6378136.05,298.2566" },
1908 {
"evrst30" ,
"6377276.345,300.8017" },
1909 {
"evrst48" ,
"6377304.063,300.8017" },
1910 {
"evrst56" ,
"6377301.243,300.8017" },
1911 {
"evrst69" ,
"6377295.664,300.8017" },
1912 {
"evrstSS" ,
"6377298.556,300.8017" },
1913 {
"fschr60" ,
"6378166.0,298.3" },
1914 {
"fschr60m" ,
"6378155.0,298.3" },
1915 {
"fschr68" ,
"6378150.0,298.3" },
1916 {
"helmert" ,
"6378200.0,298.3" },
1917 {
"hough" ,
"6378270.0,297" },
1918 {
"intl" ,
"6378388.0,297" },
1919 {
"krass" ,
"6378245.0,298.3" },
1920 {
"kaula" ,
"6378163.0,298.24" },
1921 {
"lerch" ,
"6378139.0,298.257" },
1922 {
"mprts" ,
"6397300.0,191" },
1923 {
"new_intl" ,
"6378157.5,298.2496154" },
1924 {
"plessis" ,
"6376523.0,308.6409971" },
1925 {
"SEasia" ,
"6378155.0,298.3000002" },
1926 {
"walbeck" ,
"6376896.0,302.7800002" },
1927 {
"WGS60" ,
"6378165.0,298.3" },
1928 {
"WGS66" ,
"6378145.0,298.25" },
1929 {
"WGS72" ,
"6378135.0,298.26" },
1930 {
"WGS84" ,
"6378137.0,298.2572236" },
1931 {
"sphere" ,
"6370997.0,-1" }
1935 if( _Proj4_Read_Parameter(Value, Proj4,
"ellps") )
1937 for(
int i=0; i<42; i++)
1949 double a = _Proj4_Read_Parameter(Value, Proj4,
"a" ) && Value.
asDouble(a) ? a : 6378137.;
1951 double b = _Proj4_Read_Parameter(Value, Proj4,
"b" ) && Value.
asDouble(b) ? a / (a - b)
1952 : _Proj4_Read_Parameter(Value, Proj4,
"rf") && Value.asDouble(b) ? b
1953 : _Proj4_Read_Parameter(Value, Proj4,
"f" ) && Value.asDouble(b) ? 1. / b
1954 : _Proj4_Read_Parameter(Value, Proj4,
"e" ) && Value.asDouble(b) ? a / (a - sqrt(b*b - a*a))
1955 : _Proj4_Read_Parameter(Value, Proj4,
"es") && Value.asDouble(b) ? a / (a - sqrt( b - a*a))
1966 const char datum[9][3][64] =
1968 {
"WGS84" ,
"WGS84" ,
"0,0,0,0,0,0,0" },
1969 {
"GGRS87" ,
"GRS80" ,
"-199.87,74.79,246.62,0,0,0,0" },
1970 {
"NAD83" ,
"GRS80" ,
"0,0,0,0,0,0,0" },
1972 {
"potsdam" ,
"bessel" ,
"606.0,23.0,413.0,0,0,0,0" },
1973 {
"carthage" ,
"clark80" ,
"-263.0,6.0,431.0,0,0,0,0" },
1974 {
"hermannskogel" ,
"bessel" ,
"653.0,-212.0,449.0,0,0,0,0" },
1975 {
"ire65" ,
"mod_airy" ,
"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15" },
1976 {
"nzgd49" ,
"intl" ,
"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993" },
1977 {
"OSGB36" ,
"airy" ,
"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894" }
1980 CSG_String Spheroid, ToWGS84;
1983 if( _Proj4_Read_Parameter(Value, Proj4,
"datum") )
1985 for(
int i=0; i<9; i++)
1997 if( _Proj4_Get_Ellipsoid(Spheroid, Proj4) )
1999 Value =
"DATUM[\"Datum\","+ Spheroid;
2001 if( _Proj4_Read_Parameter(ToWGS84, Proj4,
"towgs84") )
2007 ToWGS84 +=
",0,0,0,0";
2010 Value +=
",TOWGS84[" + ToWGS84 +
"]";
2014 Value +=
",TOWGS84[0,0,0,0,0,0,0]";
2023 Value =
"DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563],TOWGS84[0,0,0,0,0,0,0]]";
2031 const char meridian[12][2][16] =
2033 {
"lisbon" ,
"-9.131906111" },
2034 {
"paris" ,
"2.337229167" },
2035 {
"bogota" ,
"74.08091667" },
2036 {
"madrid" ,
"-3.687911111" },
2037 {
"rome" ,
"12.45233333" },
2038 {
"bern" ,
"7.439583333" },
2039 {
"jakarta" ,
"106.8077194" },
2040 {
"ferro" ,
"-17.66666667" },
2041 {
"brussels" ,
"4.367975" },
2042 {
"stockholm" ,
"18.05827778" },
2043 {
"athens" ,
"23.7163375" },
2044 {
"oslo" ,
"10.72291667" }
2048 if( _Proj4_Read_Parameter(Value, Proj4,
"pm") )
2050 for(
int i=0; i<12; i++)
2064 Value.
Printf(
"PRIMEM[\"Prime_Meridian\",%f]", d);
2071 Value =
"PRIMEM[\"Greenwich\",0]";
2091 if( _Proj4_Read_Parameter(Value, Proj4,
"to_meter") && Value.
asDouble(d) && d > 0. && d != 1. )
2093 Value.
Printf(
"UNIT[\"Unit\",%f]", d);
2099 Value =
"UNIT[\"metre\",1]";
2108 CSG_String Value, ProjCS;
2111 if( !_Proj4_Read_Parameter(ProjCS, Proj4,
"proj") )
2132 WKT =
"GEOGCS[\"GCS\"";
2134 if( _Proj4_Get_Datum (Value, Proj4) ) {
WKT +=
"," + Value; }
2135 if( _Proj4_Get_Prime_Meridian(Value, Proj4) ) {
WKT +=
"," + Value; }
2136 if( _Proj4_Get_Unit (Value, Proj4) ) {
WKT +=
"," + Value; }
2155 CSG_String GeogCS =
"GEOGCS[\"GCS\"";
2157 if( _Proj4_Get_Datum (Value, Proj4) ) { GeogCS +=
"," + Value; }
2158 if( _Proj4_Get_Prime_Meridian(Value, Proj4) ) { GeogCS +=
"," + Value; }
2159 if( _Proj4_Get_Unit (Value, Proj4) ) { GeogCS +=
"," + Value; }
else { GeogCS +=
"UNIT[\"degree\",0.01745329251994328]"; }
2181 if( !m_Proj4_to_WKT1.Get_Translation(ProjCS, Value) )
2195 if( !_Proj4_Read_Parameter(Value, Proj4,
"zone") || !Value.
asDouble(Zone) )
2202 bool South = _Proj4_Find_Parameter(Proj4,
"south");
2204 WKT =
CSG_String::Format(
"PROJCS[\"UTM zone %d%c\",%s,PROJECTION[Transverse_Mercator]", (
int)Zone, South ?
'S' :
'N', GeogCS.
c_str());
2211 WKT +=
",UNIT[\"metre\",1]]";
2223 while( ProjCS.
Find(
'+') >= 0 )
2230 if( m_Proj4_to_WKT1.Get_Translation(Value, Key) )
2234 if( Value.
Find(
'+') >= 0 )
2239 WKT +=
",PARAMETER[\"" + Key +
"\"," + Value +
"]";
2246 if( _Proj4_Get_Unit(Value, Proj4) ) {
WKT +=
"," + Value; }
2281 default :
return(
"UNDEFINED" );
2294 default :
return(
_TL(
"Unknown Coordinate System" ) );
2341 default:
return(
"" );
2371 default:
return(
"" );
2401 default :
return( 1. );
2413bool CSG_Projections::_Set_Dictionary(
CSG_Table &Dictionary,
int Direction)
2415 const char Translation[][4][128] = {
2419 {
"aea" ,
" ",
"Albers_Conic_Equal_Area" ,
"Albers Equal Area" },
2420 {
"aea" ,
"<",
"Albers" ,
"[ESRI] Albers Equal Area" },
2421 {
"aeqd" ,
" ",
"Azimuthal_Equidistant" ,
"Azimuthal Equidistant" },
2422 {
"airy" ,
" ",
"Airy 1830" ,
"Airy 1830" },
2423 {
"aitoff" ,
" ",
"Sphere_Aitoff" ,
"Aitoff" },
2424 {
"alsk" ,
" ",
"Mod_Stererographics_of_Alaska" ,
"*) Mod. Stererographics of Alaska" },
2425 {
"Amersfoort" ,
"<",
"D_Amersfoort" ,
"[ESRI] datum RD_NEW" },
2426 {
"Amersfoort" ,
"<",
"GCS_Amersfoort" ,
"[ESRI] GCS RD_NEW" },
2427 {
"Amersfoort / RD New",
"<",
"Amersfoort_RD_New" ,
"[ESRI] RD_NEW" },
2428 {
"apian" ,
" ",
"Apian_Globular_I" ,
"*) Apian Globular I" },
2429 {
"august" ,
" ",
"August_Epicycloidal" ,
"*) August Epicycloidal" },
2430 {
"bacon" ,
" ",
"Bacon_Globular" ,
"*) Bacon Globular" },
2431 {
"bipc" ,
" ",
"Bipolar_conic_of_western_hemisphere" ,
"*) Bipolar conic of western hemisphere" },
2432 {
"boggs" ,
" ",
"Boggs_Eumorphic" ,
"*) Boggs Eumorphic" },
2433 {
"bonne" ,
" ",
"Bonne" ,
"Bonne (Werner lat_1=90)" },
2434 {
"cass" ,
" ",
"Cassini_Soldner" ,
"Cassini" },
2435 {
"cass" ,
"<",
"Cassini" ,
"[ESRI] Cassini" },
2436 {
"cc" ,
" ",
"Central_Cylindrical" ,
"*) Central Cylindrical" },
2437 {
"cea" ,
" ",
"Cylindrical_Equal_Area" ,
"Equal Area Cylindrical, alias: Lambert Cyl.Eq.A., Normal Authalic Cyl. (FME), Behrmann (SP=30), Gall Orthogr. (SP=45)" },
2438 {
"cea" ,
"<",
"Behrmann" ,
"[ESRI] Behrmann (standard parallel = 30)" },
2439 {
"chamb" ,
" ",
"Chamberlin_Trimetric" ,
"*) Chamberlin Trimetric" },
2440 {
"collg" ,
" ",
"Collignon" ,
"*) Collignon" },
2441 {
"crast" ,
" ",
"Craster_Parabolic" ,
"[ESRI] Craster Parabolic (Putnins P4)" },
2442 {
"denoy" ,
" ",
"Denoyer_Semi_Elliptical" ,
"*) Denoyer Semi-Elliptical" },
2443 {
"eck1" ,
" ",
"Eckert_I" ,
"*) Eckert I" },
2444 {
"eck2" ,
" ",
"Eckert_II" ,
"*) Eckert II" },
2445 {
"eck3" ,
" ",
"Eckert_III" ,
"*) Eckert III" },
2446 {
"eck4" ,
" ",
"Eckert_IV" ,
"Eckert IV" },
2447 {
"eck5" ,
" ",
"Eckert_V" ,
"*) Eckert V" },
2448 {
"eck6" ,
" ",
"Eckert_VI" ,
"Eckert VI" },
2449 {
"eqearth" ,
" ",
"Equal_Earth" ,
"*) Equal Earth" },
2450 {
"eqc" ,
" ",
"Equirectangular" ,
"Equidistant Cylindrical (Plate Caree)" },
2451 {
"eqc" ,
"<",
"Equidistant_Cylindrical" ,
"[ESRI] Equidistant Cylindrical (Plate Caree)" },
2452 {
"eqc" ,
"<",
"Plate_Carree" ,
"[ESRI] Equidistant Cylindrical (Plate Caree)" },
2453 {
"eqdc" ,
" ",
"Equidistant_Conic" ,
"*) Equidistant Conic" },
2454 {
"euler" ,
" ",
"Euler" ,
"*) Euler" },
2455 {
"etmerc" ,
" ",
"Extended_Transverse_Mercator" ,
"*) Extended Transverse Mercator" },
2456 {
"fahey" ,
" ",
"Fahey" ,
"*) Fahey" },
2457 {
"fouc" ,
" ",
"Foucault" ,
"*) Foucaut" },
2458 {
"fouc_s" ,
" ",
"Foucault_Sinusoidal" ,
"*) Foucaut Sinusoidal" },
2459 {
"gall" ,
" ",
"Gall_Stereographic" ,
"Gall (Gall Stereographic)" },
2460 {
"geocent" ,
" ",
"Geocentric" ,
"*) Geocentric" },
2461 {
"geos" ,
" ",
"GEOS" ,
"Geostationary Satellite View" },
2462 {
"gins8" ,
" ",
"Ginsburg_VIII" ,
"*) Ginsburg VIII (TsNIIGAiK)" },
2463 {
"gn_sinu" ,
" ",
"General_Sinusoidal_Series" ,
"*) General Sinusoidal Series" },
2464 {
"gnom" ,
" ",
"Gnomonic" ,
"Gnomonic" },
2465 {
"goode" ,
" ",
"Goode_Homolosine" ,
"*) Goode Homolosine" },
2466 {
"gs48" ,
" ",
"Mod_Stererographics_48" ,
"*) Mod. Stererographics of 48 U.S." },
2467 {
"gs50" ,
" ",
"Mod_Stererographics_50" ,
"*) Mod. Stererographics of 50 U.S." },
2468 {
"hammer" ,
" ",
"Hammer_Eckert_Greifendorff" ,
"*) Hammer & Eckert-Greifendorff" },
2469 {
"hatano" ,
" ",
"Hatano_Asymmetrical_Equal_Area" ,
"*) Hatano Asymmetrical Equal Area" },
2470 {
"igh" ,
" ",
"Interrupted_Goodes_Homolosine" ,
"*) Interrupted Goode's Homolosine" },
2471 {
"igh_o" ,
" ",
"Interrupted_Goodes_Homolosine_Ocean" ,
"*) Interrupted Goode's Homolosine (Ocean)" },
2472 {
"imw_p" ,
" ",
"International_Map_of_the_World_Polyconic" ,
"*) International Map of the World Polyconic" },
2473 {
"kav5" ,
" ",
"Kavraisky_V" ,
"*) Kavraisky V" },
2474 {
"kav7" ,
" ",
"Kavraisky_VII" ,
"*) Kavraisky VII" },
2475 {
"krovak" ,
" ",
"Krovak" ,
"Krovak" },
2476 {
"labrd" ,
" ",
"Laborde_Oblique_Mercator" ,
"*) Laborde" },
2477 {
"laea" ,
" ",
"Lambert_Azimuthal_Equal_Area" ,
"Lambert Azimuthal Equal Area" },
2478 {
"lagrng" ,
" ",
"Lagrange" ,
"*) Lagrange" },
2479 {
"larr" ,
" ",
"Larrivee" ,
"*) Larrivee" },
2480 {
"lask" ,
" ",
"Laskowski" ,
"*) Laskowski" },
2481 {
"lcc" ,
"<",
"Lambert_Conformal_Conic_1SP" ,
"Lambert Conformal Conic (1 standard parallel)" },
2482 {
"lcc" ,
"<",
"Lambert_Conformal_Conic_2SP" ,
"Lambert Conformal Conic (2 standard parallels)" },
2483 {
"lcc" ,
" ",
"Lambert_Conformal_Conic" ,
"Lambert Conformal Conic" },
2484 {
"lcca" ,
" ",
"Lambert_Conformal_Conic_Alternative" ,
"*) Lambert Conformal Conic Alternative" },
2485 {
"leac" ,
" ",
"Lambert_Equal_Area_Conic" ,
"*) Lambert Equal Area Conic" },
2486 {
"lee_os" ,
" ",
"Lee_Oblated_Stereographic" ,
"*) Lee Oblated Stereographic" },
2487 {
"loxim" ,
" ",
"Loximuthal" ,
"[ESRI] Loximuthal" },
2488 {
"lsat" ,
" ",
"Space_oblique_for_LANDSAT" ,
"*) Space oblique for LANDSAT" },
2489 {
"mbt_s" ,
" ",
"McBryde_Thomas_Flat_Polar_Sine" ,
"*) McBryde-Thomas Flat-Polar Sine" },
2490 {
"mbt_fps" ,
" ",
"McBryde_Thomas_Flat_Polar_Sine_2" ,
"*) McBryde-Thomas Flat-Pole Sine (No. 2)" },
2491 {
"mbtfpp" ,
" ",
"McBryde_Thomas_Flat_Polar_Parabolic" ,
"*) McBride-Thomas Flat-Polar Parabolic" },
2492 {
"mbtfpq" ,
" ",
"Flat_Polar_Quartic" ,
"[ESRI] McBryde-Thomas Flat-Polar Quartic" },
2493 {
"mbtfps" ,
" ",
"McBryde_Thomas_Flat_Polar_Sinusoidal" ,
"*) McBryde-Thomas Flat-Polar Sinusoidal" },
2494 {
"merc" ,
" ",
"Mercator" ,
"[ESRI] Mercator" },
2495 {
"merc" ,
"<",
"Mercator_1SP" ,
"Mercator (1 standard parallel)" },
2496 {
"merc" ,
"<",
"Mercator_2SP" ,
"Mercator (2 standard parallels)" },
2497 {
"mil_os" ,
" ",
"Miller_Oblated_Stereographic" ,
"*) Miller Oblated Stereographic" },
2498 {
"mill" ,
" ",
"Miller_Cylindrical" ,
"Miller Cylindrical" },
2499 {
"moll" ,
" ",
"Mollweide" ,
"Mollweide" },
2500 {
"murd1" ,
" ",
"Murdoch_I" ,
"*) Murdoch I" },
2501 {
"murd2" ,
" ",
"Murdoch_II" ,
"*) Murdoch II" },
2502 {
"murd3" ,
" ",
"Murdoch_III" ,
"*) Murdoch III" },
2503 {
"nell" ,
" ",
"Nell" ,
"*) Nell" },
2504 {
"nell_h" ,
" ",
"Nell_Hammer" ,
"*) Nell-Hammer" },
2505 {
"nicol" ,
" ",
"Nicolosi_Globular" ,
"*) Nicolosi Globular" },
2506 {
"nsper" ,
" ",
"Near_sided_perspective" ,
"*) Near-sided perspective" },
2507 {
"nzmg" ,
" ",
"New_Zealand_Map_Grid" ,
"New Zealand Map Grid" },
2508 {
"ob_tran" ,
" ",
"General_Oblique_Transformation" ,
"*) General Oblique Transformation" },
2509 {
"ocea" ,
" ",
"Oblique_Cylindrical_Equal_Area" ,
"*) Oblique Cylindrical Equal Area" },
2510 {
"oea" ,
" ",
"Oblated_Equal_Area" ,
"*) Oblated Equal Area" },
2511 {
"omerc" ,
" ",
"Hotine_Oblique_Mercator" ,
"Oblique Mercator" },
2512 {
"omerc" ,
"<",
"Oblique_Mercator" ,
"Oblique Mercator" },
2513 {
"ortel" ,
" ",
"Ortelius_Oval" ,
"*) Ortelius Oval" },
2514 {
"ortho" ,
" ",
"Orthographic" ,
"Orthographic (ESRI: World from Space)" },
2515 {
"pconic" ,
" ",
"Perspective_Conic" ,
"*) Perspective Conic" },
2516 {
"poly" ,
" ",
"Polyconic" ,
"*) Polyconic (American)" },
2517 {
"putp1" ,
" ",
"Putnins_P1" ,
"*) Putnins P1" },
2518 {
"putp2" ,
" ",
"Putnins_P2" ,
"*) Putnins P2" },
2519 {
"putp3" ,
" ",
"Putnins_P3" ,
"*) Putnins P3" },
2520 {
"putp3p" ,
" ",
"Putnins_P3'" ,
"*) Putnins P3'" },
2521 {
"putp4p" ,
" ",
"Putnins_P4'" ,
"*) Putnins P4'" },
2522 {
"putp5" ,
" ",
"Putnins_P5" ,
"*) Putnins P5" },
2523 {
"putp5p" ,
" ",
"Putnins_P5'" ,
"*) Putnins P5'" },
2524 {
"putp6" ,
" ",
"Putnins_P6" ,
"*) Putnins P6" },
2525 {
"putp6p" ,
" ",
"Putnins_P6'" ,
"*) Putnins P6'" },
2526 {
"qua_aut" ,
" ",
"Quartic_Authalic" ,
"[ESRI] Quart c Authalic" },
2527 {
"robin" ,
" ",
"Robinson" ,
"Robinson" },
2528 {
"rouss" ,
" ",
"Roussilhe_Stereographic" ,
"*) Roussilhe Stereographic" },
2529 {
"rpoly" ,
" ",
"Rectangular_Polyconic" ,
"*) Rectangular Polyconic" },
2530 {
"sinu" ,
" ",
"Sinusoidal" ,
"Sinusoidal (Sanson-Flamsteed)" },
2531 {
"somerc" ,
" ",
"Hotine_Oblique_Mercator" ,
"Swiss Oblique Mercator" },
2532 {
"somerc" ,
"<",
"Swiss_Oblique_Cylindrical" ,
"Swiss Oblique Cylindrical" },
2533 {
"somerc" ,
"<",
"Hotine_Oblique_Mercator_Azimuth_Center" ,
"[ESRI] Swiss Oblique Mercator/Cylindrical" },
2534 {
"stere" ,
"<",
"Polar_Stereographic" ,
"Stereographic" },
2535 {
"stere" ,
" ",
"Stereographic" ,
"[ESRI] Stereographic" },
2536 {
"sterea" ,
" ",
"Oblique_Stereographic" ,
"Oblique Stereographic Alternative" },
2537 {
"sterea" ,
"<",
"Double_Stereographic" ,
"[ESRI]" },
2538 {
"gstmerc" ,
" ",
"Gauss_Schreiber_Transverse_Mercator" ,
"*) Gauss-Schreiber Transverse Mercator (aka Gauss-Laborde Reunion)" },
2539 {
"tcc" ,
" ",
"Transverse_Central_Cylindrical" ,
"*) Transverse Central Cylindrical" },
2540 {
"tcea" ,
" ",
"Transverse_Cylindrical_Equal_Area" ,
"*) Transverse Cylindrical Equal Area" },
2541 {
"tissot" ,
" ",
"Tissot_Conic" ,
"*) Tissot Conic" },
2542 {
"tmerc" ,
" ",
"Transverse_Mercator" ,
"*) Transverse Mercator" },
2543 {
"tmerc" ,
"<",
"Gauss_Kruger" ,
"[ESRI] DHDN" },
2544 {
"tpeqd" ,
" ",
"Two_Point_Equidistant" ,
"*) Two Point Equidistant" },
2545 {
"tpers" ,
" ",
"Tilted_perspective" ,
"*) Tilted perspective" },
2546 {
"ups" ,
" ",
"Universal_Polar_Stereographic" ,
"*) Universal Polar Stereographic" },
2547 {
"urm5" ,
" ",
"Urmaev_V" ,
"*) Urmaev V" },
2548 {
"urmfps" ,
" ",
"Urmaev_Flat_Polar_Sinusoidal" ,
"*) Urmaev Flat-Polar Sinusoidal" },
2549 {
"utm" ,
">",
"Transverse_Mercator" ,
"*) Universal Transverse Mercator (UTM)" },
2550 {
"vandg" ,
"<",
"Van_Der_Grinten_I" ,
"[ESRI] van der Grinten (I)" },
2551 {
"vandg" ,
" ",
"VanDerGrinten" ,
"van der Grinten (I)" },
2552 {
"vandg2" ,
" ",
"VanDerGrinten_II" ,
"*) van der Grinten II" },
2553 {
"vandg3" ,
" ",
"VanDerGrinten_III" ,
"*) van der Grinten III" },
2554 {
"vandg4" ,
" ",
"VanDerGrinten_IV" ,
"*) van der Grinten IV" },
2555 {
"vitk1" ,
" ",
"Vitkovsky_I" ,
"*) Vitkovsky I" },
2556 {
"wag1" ,
" ",
"Wagner_I" ,
"*) Wagner I (Kavraisky VI)" },
2557 {
"wag2" ,
" ",
"Wagner_II" ,
"*) Wagner II" },
2558 {
"wag3" ,
" ",
"Wagner_III" ,
"*) Wagner III" },
2559 {
"wag4" ,
" ",
"Wagner_IV" ,
"*) Wagner IV" },
2560 {
"wag5" ,
" ",
"Wagner_V" ,
"*) Wagner V" },
2561 {
"wag6" ,
" ",
"Wagner_VI" ,
"*) Wagner VI" },
2562 {
"wag7" ,
" ",
"Wagner_VII" ,
"*) Wagner VII" },
2563 {
"webmerc" ,
" ",
"Mercator_1SP" ,
"Web Mercator" },
2564 {
"webmerc" ,
"<",
"Mercator_Auxiliary_Sphere" ,
"[ESRI] Web Mercator" },
2565 {
"weren" ,
" ",
"Werenskiold_I" ,
"*) Werenskiold I" },
2566 {
"wink1" ,
" ",
"Winkel_I" ,
"[ESRI] Winkel I" },
2567 {
"wink2" ,
" ",
"Winkel_II" ,
"[ESRI] Winkel II" },
2568 {
"wintri" ,
" ",
"Winkel_Tripel" ,
"[ESRI] Winkel Tripel" },
2571 {
"alpha" ,
" ",
"azimuth" ,
"? Used with Oblique Mercator and possibly a few others" },
2572 {
"k" ,
">",
"scale_factor" ,
"Scaling factor (old name)" },
2573 {
"K" ,
">",
"scale_factor" ,
"? Scaling factor (old name)" },
2574 {
"k_0" ,
" ",
"scale_factor" ,
"Scaling factor (new name)" },
2575 {
"lat_0" ,
" ",
"latitude_of_origin" ,
"Latitude of origin" },
2576 {
"lat_0" ,
"<",
"latitude_of_center" ,
"Latitude of center" },
2577 {
"lat_0" ,
"<",
"central_parallel" ,
"[ESRI] Latitude of center" },
2578 {
"lat_1" ,
" ",
"standard_parallel_1" ,
"Latitude of first standard parallel" },
2579 {
"lat_2" ,
" ",
"standard_parallel_2" ,
"Latitude of second standard parallel" },
2580 {
"lat_ts" ,
">",
"latitude_of_origin" ,
"Latitude of true scale" },
2581 {
"lon_0" ,
" ",
"central_meridian" ,
"Central meridian" },
2582 {
"lon_0" ,
"<",
"longitude_of_center" ,
"Longitude of center" },
2583 {
"lonc" ,
">",
"longitude_of_center" ,
"? Longitude used with Oblique Mercator and possibly a few others" },
2584 {
"x_0" ,
" ",
"false_easting" ,
"False easting" },
2585 {
"y_0" ,
" ",
"false_northing" ,
"False northing" },
2595 {
"h" ,
" ",
"satellite_height",
"Satellite height (geos - Geostationary Satellite View)" },
2667 Dictionary.
Set_Name(
"Proj.4-WKT Dictionary");
2669 if( Direction == 0 )
2676 for(
int i=0; *Translation[i][0]; i++)
2678 CSG_Table_Record &Entry = *Dictionary.
Add_Record();
2686 else if( Direction > 0 )
2691 for(
int i=0; *Translation[i][0]; i++)
2693 if( Translation[i][1][0] !=
'<' )
2695 CSG_Table_Record &Entry = *Dictionary.
Add_Record();
2702 else if( Direction < 0 )
2707 for(
int i=0; *Translation[i][0]; i++)
2709 if( Translation[i][1][0] !=
'>' )
2711 CSG_Table_Record &Entry = *Dictionary.
Add_Record();
2723bool CSG_Projections::_Set_Dictionary(
void)
2727 return( _Set_Dictionary(Table, 1) && m_Proj4_to_WKT1.Create(&Table, 0, 1,
true)
2728 && _Set_Dictionary(Table, -1) && m_WKT1_to_Proj4.Create(&Table, 0, 1,
true)
2746 return( pTarget ? pTarget->
Create(*pSource) :
true );
2751 pTarget->
Create(*pSource); pSource = pTarget;
2768 bool bResult = pTool->
Execute();
2771 Data.
Delete(pSource,
true);
2784 if( Source == Target )
2805 bool bResult = pTool->
Execute();
2826 if( Source == Target )
2861 bool bResult =
false;
void SG_UI_Msg_Add_Error(const char *Message)
int SG_UI_Msg_Lock(bool bOn)
void SG_UI_ProgressAndMsg_Lock(bool bOn)
CSG_String SG_UI_Get_Application_Path(bool bPathOnly)
CSG_String SG_UI_Get_API_Path(void)
SAGA_API_DLL_EXPORT bool SG_File_Exists(const CSG_String &FileName)
SAGA_API_DLL_EXPORT CSG_String SG_File_Make_Path(const CSG_String &Directory, const CSG_String &Name)
SAGA_API_DLL_EXPORT bool SG_File_Delete(const CSG_String &FileName)
SAGA_API_DLL_EXPORT CSG_Strings SG_String_Tokenize(const CSG_String &String, const CSG_String &Delimiters=SG_DEFAULT_DELIMITERS, TSG_String_Tokenizer_Mode Mode=SG_TOKEN_DEFAULT)
SAGA_API_DLL_EXPORT CSG_String SG_Get_String(double Value, int Precision=-99)
CSG_Data_Object * Add(CSG_Data_Object *pObject)
bool Delete(CSG_Data_Object *pObject, bool bDetach=false)
void Set_Name(const CSG_String &Name)
CSG_Projection & Get_Projection(void)
size_t Write(void *Buffer, size_t Size, size_t Count=1) const
size_t Read(void *Buffer, size_t Size, size_t Count=1) const
bool is_Writing(void) const
bool is_Reading(void) const
virtual bool is_Valid(void) const
bool Create(const CSG_Grid &Grid)
const CSG_Grid_System & Get_System(void) const
double asDouble(void) const
const SG_Char * asString(void) const
virtual ~CSG_Projection(void)
CSG_String Get_Type_Identifier(void) const
bool is_Geographic(void) const
static const CSG_Projection & Get_GCS_WGS84(void)
CSG_String Get_Unit_Name(void) const
CSG_String Get_JSON(void) const
static CSG_Projection Get_UTM_WGS84(int Zone, bool bSouth=false)
bool is_Projection(void) const
const CSG_String & Get_PROJ(void) const
ESG_CRS_Type Get_Type(void) const
CSG_String Get_ESRI(void) const
const CSG_String & Get_WKT2(void) const
bool is_Equal(const CSG_Projection &Projection) const
bool Set_UTM_WGS84(int Zone, bool bSouth=false)
CSG_String Get_XML(void) const
bool Save(const CSG_String &File, ESG_CRS_Format Format=ESG_CRS_Format::WKT) const
CSG_String Get_Description(bool bDetails=false) const
CSG_String Get_Unit_Identifier(void) const
bool Create(const CSG_Projection &Projection)
CSG_String Get_Type_Name(void) const
double Get_Unit_To_Meter(void) const
bool is_Geodetic(void) const
bool Load(const CSG_String &File)
CSG_String Get_WKT1(void) const
static ESG_Projection_Unit Get_Unit(const CSG_String &Identifier)
CSG_String Get_Names_List(ESG_CRS_Type Type=ESG_CRS_Type::Undefined, bool bAddSelect=true) const
bool Create(bool LoadCodeList=true)
bool Save(const CSG_String &File)
CSG_Projection Get_Projection(sLong Index) const
static bool Parse(const CSG_String &Definition, CSG_String *PROJ=NULL, CSG_String *WKT2=NULL, CSG_String *WKT1=NULL, CSG_String *JSON=NULL, CSG_String *ESRI=NULL)
virtual ~CSG_Projections(void)
static CSG_String Get_CRS_Type_Identifier(ESG_CRS_Type Type)
static const CSG_String Get_Unit_Name(ESG_Projection_Unit Unit, bool bSimple=true)
static const CSG_String Get_Unit_Identifier(ESG_Projection_Unit Unit)
static CSG_String Convert_WKT2_to_XML(const CSG_String &WKT)
sLong Get_Count(void) const
static ESG_CRS_Type Get_CRS_Type(const CSG_String &Identifier)
bool Add(const CSG_Projection &Projection)
bool Load(const CSG_String &File, bool bAppend=false)
bool Get_Preference(CSG_Projection &Projection, int Code, const CSG_String &Authority) const
static CSG_String Get_CRS_Type_Name(ESG_CRS_Type Type)
static double Get_Unit_To_Meter(ESG_Projection_Unit Unit)
friend class CSG_Projection
virtual int Add_Point(double x, double y, int iPart=0)=0
virtual bool is_Valid(void) const
virtual CSG_Shape * Add_Shape(CSG_Table_Record *pCopy=NULL, TSG_ADD_Shape_Copy_Mode mCopy=SHAPE_COPY)
virtual const CSG_Rect & Get_Extent(void)
bool Create(const CSG_Shapes &Shapes)
size_t Length(void) const
CSG_String AfterFirst(char Character) const
int CmpNoCase(const CSG_String &String) const
int Cmp(const CSG_String &String) const
CSG_String BeforeFirst(char Character) const
size_t Replace(const CSG_String &Old, const CSG_String &New, bool bReplaceAll=true)
CSG_String BeforeLast(char Character) const
static CSG_String Format(const char *Format,...)
int Find(char Character, bool fromEnd=false) const
const SG_Char * c_str(void) const
int Printf(const char *Format,...)
bool is_Empty(void) const
CSG_String Left(size_t count) const
double asDouble(void) const
bool Add(const CSG_Strings &Strings)
int Get_Count(void) const
bool Set_Value(int Field, const CSG_String &Value)
int asInt(int Field) const
bool is_Selected(void) const
const SG_Char * asString(int Field, int Decimals=-99) const
sLong Get_Count(void) const
virtual bool Destroy(void)
virtual bool Del_Records(void)
virtual CSG_Table_Record * Add_Record(CSG_Table_Record *pCopy=NULL)
bool Set_Index(CSG_Index &Index, int Field, bool bAscending=true) const
virtual CSG_Table_Record * Get_Record(sLong Index) const
int Get_Field_Count(void) const
virtual bool Add_Field(const CSG_String &Name, TSG_Data_Type Type, int Position=-1)
CSG_Table_Record * Get_Record_byIndex(sLong Index) const
CSG_Projections gSG_Projections
bool SG_Get_Projected(CSG_Shapes *pSource, CSG_Shapes *pTarget, const CSG_Projection &Target)
#define CMP_PARAMETER(a, b)
#define CMP_PROPERTY(a, b, p)
bool SG_Grid_Get_Geographic_Coordinates(CSG_Grid *pGrid, CSG_Grid *pLon, CSG_Grid *pLat)
#define ADD_INFO(name, value)
#define ADD_HEAD(name, value)
#define ADD_PROP(name, entry, prop)
#define ADD_CONT(name, entry)
#define CMP_CONTENT(a, b)
CSG_Projections & SG_Get_Projections(void)