11 std::vector<unsigned int> epsgs;
42 std::cout <<
"Describing coordinate systems by ID - begin" << std::endl;
46 std::pair<std::string,unsigned int> srid;
47 for (
size_t i=0; i<epsgs.size();++i)
49 std::cout <<
"\n -- " << epsgs[i] <<
" -- \n";
51 std::cout <<
" Name: " << name;
53 if (srid.second == epsgs[i])
54 std::cout <<
". Id from name OK" << std::endl;
56 std::cout <<
". Id from name NOT OK" << std::endl;
59 std::cout <<
" WKT: " << wkt.substr(0,60) <<
"... ";
61 if (srid.second == epsgs[i])
62 std::cout <<
". Id from wkt OK" << std::endl;
64 std::cout <<
" Id from wkt NOT OK" << std::endl;
67 std::cout <<
" PROJ4: " << p4txt.substr(0,60) <<
"... ";
69 if (srid.second == epsgs[i])
70 std::cout <<
". Id from PROJ4 txt OK" << std::endl;
72 std::cout <<
". Id from PROJ4 txt NOT OK" << std::endl;
74 std::cout <<
"\nDescribing coordinate systems by ID - end " << std::endl << std::endl;
81 std::cout <<
"Showing how SRID's are recognized by the converter - begin" << std::endl;
83 std::vector<int> epsgs;
115 for (
size_t i=0; i<epsgs.size();++i)
119 converter->setSourceSRID(epsgs[i]);
120 std::cout <<
"SRS identifier " << epsgs[i] <<
" recognized\n";
123 std::cout <<
"SRS identifier " << epsgs[i] <<
" NOT recognized\n";
126 std::cout <<
"Showing how SRID's are recognized by the converter - end " << std::endl << std::endl;
132 std::cout <<
"Showing how Convert coordinates - end " << std::endl << std::endl;
134 std::cout <<
"Converting a geometry: " << std::endl;
136 std::cout << geom->
asText() << std::endl;
138 std::cout << std::endl;
141 std::cout << geom->
asText() << std::endl;
145 std::cout << std::endl;
146 std::cout.setf(std::ios::fixed,std::ios::floatfield);
147 std::cout.precision(5);
149 std::cout <<
"Converting one Coordinate: " << std::endl;
159 converter->convert(llX,llY,xyX,xyY);
160 std::cout << llX <<
" " << llY <<
" >>>> " << xyX <<
" " << xyY << std::endl;
164 converter->invert(xyX,xyY,llX,llY);
166 std::cout << llX <<
" " << llY <<
" <<<< " << xyX <<
" " << xyY << std::endl;
171 std::cout << std::endl;
172 std::cout <<
"Converting a list of coordinates: " << std::endl;
174 double* xs =
new double[3];
175 double* ys =
new double[3];
185 converter->convert(xs,ys,3,1);
190 std::cout << std::endl;
191 std::cout <<
"Converting a coordinate after include a CS to the Manager: " << std::endl;
193 std::string p4txt =
"+proj=utm +zone=23 +south +ellps=WGS84 +datum=WGS84 +units=km +no_defs";
194 converter->setSourcePJ4txt(p4txt);
197 xyX = 500000 * 0.001;
198 xyY = 10000000 * 0.001;
200 converter->convert(xyX,xyY,llX,llY);
202 std::cout << xyX <<
" " << xyY <<
" >>>> " << llX <<
" " << llY << std::endl;
204 std::cout <<
"Showing how Convert coordinates - end " << std::endl << std::endl;
void ConvertCoordinates()
This example shows how to transform a geometry from an SRS to another.
This file contains include headers for TerraLib Spatial Reference System module.
Several examples on how to use Spatial Reference Systens handling in TerraLib.
#define TE_SRS_SAD69_UTM_ZONE_22N
#define TE_SRS_CORREGO_ALEGRE_UTM_ZONE_21S
#define TE_SRS_SAD69_POLYCONIC
#define TE_SRS_WGS84_UTM_ZONE_25S
#define TE_SRS_WGS84_ANTARTIC_POLAR_STEREOGRAPHIC
static SpatialReferenceSystemManager & getInstance()
It returns a reference to the singleton instance.
A point with x and y coordinate values.
#define TE_SRS_SIRGAS2000_UTM_ZONE_18N
void SpatialReferenceSystemManager()
This example shows how to use the Spatial Reference Systems Manager.
std::string asText() const _NOEXCEPT_OP(true)
It returns an string with the Well-Known Text Representation for the geometry.
void RecognizeSRIDs()
This example shows how Coordinate Systems from identifiers are recognized by the converter.
#define TE_SRS_CORREGO_ALEGRE_UTM_ZONE_25S
#define TE_SRS_SAD69_UTM_ZONE_25S
#define TE_SRS_WGS84_UTM_ZONE_23S
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
A Converter is responsible for the conversion of coordinates between different Coordinate Systems (CS...
#define TE_SRS_SIRGAS2000
#define TE_SRS_WGS84_UTM_ZONE_17S
This file contains include headers for the TerraLib Common Runtime module.
#define TE_SRS_WGS84_UTM_ZONE_18N
This file contains include headers for the Vector Geometry model of TerraLib.
virtual void transform(int srid) _NOEXCEPT_OP(false)=0
It converts the coordinate values of the geometry to the new spatial reference system.
#define TE_SRS_CORREGO_ALEGRE
#define TE_SRS_WGS84_UTM_ZONE_22N
#define TE_SRS_SAD69_UTM_ZONE_17S
#define TE_SRS_SAD69_UTM_ZONE_18N
#define TE_SRS_SIRGAS2000_UTM_ZONE_22N