10 std::unique_ptr<te::da::DataSourceTransactor> transactor = ds->
getTransactor();
12 std::unique_ptr<te::da::DataSet> dataset = ds->
getDataSet(
"public.br_munic_2001");
18 std::cout << std::endl <<
"=== DataSet: public.br_munic_2001: 5 first rows" << std::endl;
20 while(dataset->moveNext() && row<5)
22 std::string municName = dataset->getString(2);
24 std::cout << std::endl <<
"City Name: " << municName;
26 std::cout << std::endl <<
"ROW: " << row++ <<
"\t";
30 std::cout << dataset->getPropertyName(pos) <<
": " << g->
asText() << std::endl;
35 std::cout << std::endl;
46 std::unique_ptr<te::da::DataSet> dataset = transactor->getDataSet(
"public.br_munic_2001",
"geom", &pt,
te::gm::INTERSECTS);
52 std::cout << std::endl <<
"=== DataSet: public.br_munic_2001: objects that intercepts location (-43.6107606714293, -20.3913548070123)" << std::endl;
54 while(dataset->moveNext())
56 std::string municName = dataset->getString(2);
57 std::cout << std::endl <<
"City Name: " << municName;
59 std::cout << std::endl <<
"ROW: " << row++ <<
"\t";
65 geomMunic =
static_cast<te::gm::Geometry*
>(dataset->getGeometry(pos)->clone());
67 std::cout << dataset->getPropertyName(pos) <<
": " << geomMunic->
asText() << std::endl;
70 std::cout << std::endl;
77 std::unique_ptr<te::da::DataSet> dataset = transactor->getDataSet(
"public.br_munic_2001",
"geom", geomMunic,
te::gm::INTERSECTS);
83 std::cout << std::endl <<
"=== DataSet: public.br_munic_2001: objects that intercepts the last object found in the previous query" << std::endl;
85 while(dataset->moveNext())
87 std::string municName = dataset->getString(2);
88 std::cout << std::endl <<
"City Name: " << municName;
90 std::cout << std::endl <<
"ROW: " << row++ <<
"\t";
94 std::cout << dataset->getPropertyName(pos) <<
": " << g->
asText() << std::endl;
98 std::cout << std::endl;
106 s->
setPoint(0, -43.932979522347395, -20.632799968306863);
107 s->
setPoint(1, -43.932979522347395, -20.161208868097958);
108 s->
setPoint(2, -43.600000000000000, -19.500000000000000);
109 s->
setPoint(3, -43.403643659752738, -20.161208868097958);
110 s->
setPoint(4, -43.403643659752738, -20.632799968306863);
111 s->
setPoint(5, -43.932979522347395, -20.632799968306863);
117 std::cout << std::endl <<
"Created a polygon with: " << pol->
getNPoints() <<
"points. " << std::endl;
119 std::unique_ptr<te::da::DataSet> dataset = transactor->getDataSet(
"public.br_munic_2001",
"geom", pol,
te::gm::INTERSECTS);
125 std::cout << std::endl <<
"=== DataSet: public.br_munic_2001: objects that intercept the polygon" << std::endl;
127 while(dataset->moveNext())
129 std::string municName = dataset->getString(2);
130 std::cout << std::endl <<
"City Name: " << municName;
132 std::cout << std::endl <<
"ROW: " << row++ <<
"\t";
136 std::cout << dataset->getPropertyName(pos) <<
": " << g->
asText() << std::endl;
140 std::cout << std::endl;
145 te::gm::Envelope box(-43.9329795837402, -20.6328010559082, -43.4036407470703, -20.1612071990967);
147 std::unique_ptr<te::da::DataSet> dataset = transactor->getDataSet(
"public.br_munic_2001",
"geom", &box,
te::gm::INTERSECTS);
153 std::cout << std::endl <<
"=== DataSet: public.br_munic_2001: objects that intercept a box" << std::endl;
155 while(dataset->moveNext())
157 std::string municName = dataset->getString(2);
158 std::cout << std::endl <<
"City Name: " << municName;
160 std::cout << std::endl <<
"ROW: " << row++ <<
"\t";
164 std::cout << dataset->getPropertyName(pos) <<
": " << g->
asText() << std::endl;
168 std::cout << std::endl;
void push_back(Curve *ring)
It adds the curve to the curve polygon.
virtual std::unique_ptr< DataSourceTransactor > getTransactor()=0
It returns the set of parameters used to set up the access channel to the underlying repository...
void setSRID(int srid)
It sets the Spatial Reference System ID of the geometry and all its parts if it is a GeometryCollecti...
static te::dt::Date ds(2010, 01, 01)
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
A LinearRing is a LineString that is both closed and simple.
int getSRID() const _NOEXCEPT_OP(true)
It returns the Spatial Reference System ID associated to this geometric object.
virtual void computeMBR(bool cascade) const _NOEXCEPT_OP(true)=0
It computes the minimum bounding rectangle for the geometry.
std::size_t getNPoints() const
it returns the number of points (vertexes) in the geometry.
A point with x and y coordinate values.
void setPoint(std::size_t i, const double &x, const double &y)
It sets the value of the specified point.
An Envelope defines a 2D rectangular region.
std::string asText() const _NOEXCEPT_OP(true)
It returns an string with the Well-Known Text Representation for the geometry.
Examples on how to access/manipulate DataSources in TerraLib.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
virtual std::unique_ptr< DataSet > getDataSet(const std::string &name, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It gets the dataset identified by the given name. This method always returns a disconnected dataset...
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
void RetrieveUsingSpatialFilter(te::da::DataSource *ds)
An example showing how to retrieve data using a spatial filter.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)