TerraLib and TerraView Wiki Page

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
wiki:documentation:devguide:srs_module [2016/01/11 15:40]
lubia
wiki:documentation:devguide:srs_module [2016/01/20 10:15]
lubia [Coordinate Transformation]
Line 15: Line 15:
 The class ''​SpatialReferenceSystemMananger''​ is responsible for handling the Spatial Reference in TerraLib applications. The manager is a singleton, i.e., there is only one instance of this class per application. By default the SRS Manager is initialized in TerraLib from the ''​srs.json''​ file, that can be founded in  the subdirectory ''​share/​terralib/​json''​ of your local codebase folder. The class ''​SpatialReferenceSystemMananger''​ is responsible for handling the Spatial Reference in TerraLib applications. The manager is a singleton, i.e., there is only one instance of this class per application. By default the SRS Manager is initialized in TerraLib from the ''​srs.json''​ file, that can be founded in  the subdirectory ''​share/​terralib/​json''​ of your local codebase folder.
  
-The snippet code bellow ​shows how to retrieve ​the number of SRS currently available ​in the Manager.+The snippet code bellow ​exemplifies ​how to manipulate ​the Manager. Note that the names from this module are in the namespace ''​te::​srs''​.
  
 <code cpp> <code cpp>
 { {
- int nsrs = SpatialReferenceSystemManager::​getInstance().size();​ +  ​int nsrs = te::srs::SpatialReferenceSystemManager::​getInstance().size();​ 
- ​std::​cout << "There are " << nsrs << " available in the SRS Manager ";+  std::cout << "There are " << nsrs << " available in the SRS Manager.\n"
 + 
 +  std::cout << "​Searching for an SRS named \"WGS 84\": \n"; 
 +  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 << "​Searching for an SRS with the ID \"​EPSG:​4326\":​ \n"; 
 +  std::string myname = te::​srs::​SpatialReferenceSystemManager::​getInstance().getName(4326);​ 
 +  std::cout << "​EPSG:​4326 => " << myname << std::endl;
 } }
 </​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.
Line 105: Line 112:
 </​code>​ </​code>​
  
 +===== Module Dependencies =====