Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
wiki:documentation:devguide:srs_module [2016/01/20 10:11] lubia [SRS Representation] |
wiki:documentation:devguide:srs_module [2016/01/20 10:15] lubia [Coordinate Transformation] |
||
---|---|---|---|
Line 25: | Line 25: | ||
std::pair<std::string,int> myid = te::srs::SpatialReferenceSystemManager::getInstance().getIdFromName("WGS 84"); | std::pair<std::string,int> myid = te::srs::SpatialReferenceSystemManager::getInstance().getIdFromName("WGS 84"); | ||
std::cout << "WGS 84 => " << myid.second << " from " << myid.first << " authority." << std::endl; | std::cout << "WGS 84 => " << myid.second << " from " << myid.first << " authority." << std::endl; | ||
- | |||
std::cout << "Searching for an SRS with the ID \"EPSG:4326\": \n"; | std::cout << "Searching for an SRS with the ID \"EPSG:4326\": \n"; | ||
std::string myname = te::srs::SpatialReferenceSystemManager::getInstance().getName(4326); | std::string myname = te::srs::SpatialReferenceSystemManager::getInstance().getName(4326); | ||
std::cout << "EPSG:4326 => " << myname << std::endl; | std::cout << "EPSG:4326 => " << myname << std::endl; | ||
- | TerraLib::getInstance().finalize(); | ||
- | |||
} | } | ||
</code> | </code> | ||
- | |||
===== Coordinate Transformation ===== | ===== Coordinate Transformation ===== | ||
- | TerraLib uses the [[https://github.com/OSGeo/proj.4/wiki|PROJ.4]] library to implement coordinate transformations. The simplest way to do it is by creating an object of the class ''Converter'', that will be responsible by transforming coordinates from a source SRS Id to a target SRS ID, both represented by an unique integer identifier. The SRSID should exist in the SRSManager described above. | + | TerraLib uses the [[https://github.com/OSGeo/proj.4/wiki|PROJ.4]] library to implement coordinate transformations. The access and call to PROJ.4 is encapsulated in the class ''Converter'', that will be responsible by transforming coordinates from a source SRS Id to a target SRS ID, both represented by an unique integer identifier or SRID. The SRID should exist in the SRSManager described above. |
The code snippet below shows how an application can request a ''Converter'' to convert some coordinates. | The code snippet below shows how an application can request a ''Converter'' to convert some coordinates. |