19 #include <boost/uuid/random_generator.hpp> 20 #include <boost/uuid/uuid_io.hpp> 32 std::string data_dir = TERRALIB_DATA_DIR;
34 std::string filename(data_dir +
"/shape/SP_cities.shp");
36 std::string srcInfo (
"file://" + filename);
41 std::string inDsetName =
"SP_cities";
42 if (!srcDs->dataSetExists(inDsetName))
44 std::cout <<
"Input dataset not found: " << inDsetName << std::endl;
52 std::vector<std::string> selProperties;
53 selProperties.push_back(
"NOMEMESO");
55 std::map<std::string, te::dt::AbstractData*> specificParams;
56 specificParams[
"DISSOLVE"] =
59 specificParams[
"IS_COLLECTION"] =
62 std::map<te::dt::Property*, std::vector<te::stat::StatisticalSummary> > stats;
64 std::unique_ptr<te::dt::Property> prop1 =
65 srcDs->getProperty(inDsetName,
"POPULACA");
67 std::vector<te::stat::StatisticalSummary> stat1;
71 stats.insert(std::make_pair(prop1.get(), stat1));
74 std::map<te::dt::Property*, std::vector<te::stat::StatisticalSummary> > >(
80 int inputSRID = geomInputProp->getSRID();
82 std::string filename2(data_dir +
"/shape/dissolve_ogrtoogr.shp");
83 std::string tgrInfo (
"file://" + filename2);
88 std::string outDS =
"dissolve_ogrtoogr";
90 if (trgDs->dataSetExists(outDS))
92 std::cout <<
"A dataset with the same requested output dataset name " 93 "already exists: " << outDS << std::endl;
98 std::vector<te::vp::InputParams> inputParamsVec;
108 inputParamsVec.push_back(structInputParams);
129 std::string data_dir = TERRALIB_DATA_DIR;
131 std::string filename(data_dir +
"/shape/SP_cities.shp");
133 std::string srcInfo(
"file://" + filename);
138 std::string inDsetName =
"SP_cities";
139 if (!srcDs->dataSetExists(inDsetName))
141 std::cout <<
"Input dataset not found: " << inDsetName << std::endl;
149 std::vector<std::string> selProperties;
150 selProperties.push_back(
"NOMEMESO");
152 std::map<std::string, te::dt::AbstractData*> specificParams;
153 specificParams[
"DISSOLVE"] =
156 specificParams[
"IS_COLLECTION"] =
159 std::map<te::dt::Property*, std::vector<te::stat::StatisticalSummary> > stats;
161 std::unique_ptr<te::dt::Property> prop1 =
162 srcDs->getProperty(inDsetName,
"POPULACA");
164 std::vector<te::stat::StatisticalSummary> stat1;
168 stats.insert(std::make_pair(prop1.get(), stat1));
171 std::map<te::dt::Property*, std::vector<te::stat::StatisticalSummary> > >(
177 int inputSRID = geomInputProp->getSRID();
179 std::string connInfo(
180 "ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS");
186 std::string outDS =
"dissolve_ogrtopgis";
188 if (trgDs->dataSetExists(outDS))
190 std::cout <<
"A dataset with the same requested output dataset name " 191 "already exists: " << outDS << std::endl;
196 std::vector<te::vp::InputParams> inputParamsVec;
206 inputParamsVec.push_back(structInputParams);
227 boost::uuids::basic_random_generator<boost::mt19937> gen;
228 boost::uuids::uuid u = gen();
229 std::string dsId = boost::uuids::to_string(u);
231 std::string connInfo(
232 "ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS");
239 dsInfoPtr->setId(dsId);
240 dsInfoPtr->setConnInfo(connInfo);
241 dsInfoPtr->setType(
"POSTGIS");
247 std::string inDsetName =
"sp_cities";
248 if (!srcDs->dataSetExists(inDsetName))
250 std::cout <<
"Input dataset not found: " << inDsetName << std::endl;
257 std::vector<std::string> selProperties;
258 selProperties.push_back(
"nomemeso");
260 std::map<std::string, te::dt::AbstractData*> specificParams;
261 specificParams[
"DISSOLVE"] =
264 specificParams[
"IS_COLLECTION"] =
267 std::map<te::dt::Property*, std::vector<te::stat::StatisticalSummary> > stats;
269 std::unique_ptr<te::dt::Property> prop1 =
270 srcDs->getProperty(inDsetName,
"populaca");
272 std::vector<te::stat::StatisticalSummary> stat1;
276 stats.insert(std::make_pair(prop1.get(), stat1));
279 std::map<te::dt::Property*, std::vector<te::stat::StatisticalSummary> > >(
285 int inputSRID = geomInputProp->getSRID();
291 fields->push_back(f_all);
297 from->push_back(fromItem);
300 std::string outDS =
"dissolve_pgistopgis";
302 if (srcDs->dataSetExists(outDS))
304 std::cout <<
"A dataset with the same requested output dataset name " 305 "already exists: " << outDS << std::endl;
310 std::vector<te::vp::InputParams> inputParamsVec;
322 inputParamsVec.push_back(structInputParams);
343 boost::uuids::basic_random_generator<boost::mt19937> gen;
344 boost::uuids::uuid u = gen();
345 std::string dsId = boost::uuids::to_string(u);
347 std::string connInfo(
348 "ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS");
355 dsInfoPtr->setId(dsId);
356 dsInfoPtr->setConnInfo(connInfo);
357 dsInfoPtr->setType(
"POSTGIS");
363 std::string inDsetName =
"sp_cities";
364 if (!srcDs->dataSetExists(inDsetName))
366 std::cout <<
"Input dataset not found: " << inDsetName << std::endl;
373 std::vector<std::string> selProperties;
374 selProperties.push_back(
"nomemeso");
376 std::map<std::string, te::dt::AbstractData*> specificParams;
377 specificParams[
"DISSOLVE"] =
380 specificParams[
"IS_COLLECTION"] =
383 std::map<te::dt::Property*, std::vector<te::stat::StatisticalSummary> > stats;
385 std::unique_ptr<te::dt::Property> prop1 =
386 srcDs->getProperty(inDsetName,
"populaca");
388 std::vector<te::stat::StatisticalSummary> stat1;
392 stats.insert(std::make_pair(prop1.get(), stat1));
395 std::map<te::dt::Property*, std::vector<te::stat::StatisticalSummary> > >(
401 int inputSRID = geomInputProp->getSRID();
407 fields->push_back(f_all);
413 from->push_back(fromItem);
416 std::string data_dir = TERRALIB_DATA_DIR;
418 std::string uriResult(data_dir +
"/shape/dissolve_pgistoogr.shp");
419 std::string tgrInfo(
"file://" + uriResult);
424 std::string outDS =
"dissolve_pgistoogr";
426 if (trgDs->dataSetExists(outDS))
428 std::cout <<
"A dataset with the same requested output dataset name " 429 "already exists: " << outDS << std::endl;
434 std::vector<te::vp::InputParams> inputParamsVec;
445 inputParamsVec.push_back(structInputParams);
void setOutputSRID(const int &outputSRID)
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
An abstract class that models a source of data in a query.
An abstract class that models a source of data in a query.
The Field class can be used to model an expression that takes part of the output items of a SELECT...
A class that models the name of a dataset used in a From clause.
boost::shared_ptr< DataSource > DataSourcePtr
A class that models the description of a dataset.
bool executeQuery(te::vp::AlgorithmParams *mainParams)
void setOutputDataSetName(const std::string &outputDataSetName)
void setOutputDataSource(te::da::DataSourcePtr outputDataSource)
A singleton to keep all the registered data sources.
bool DissolvePGISToPGIS()
Utility functions for Vector Processing.
A template for complex data types.
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance.
bool executeMemory(te::vp::AlgorithmParams *mainParams)
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
A factory for data sources.
A Select models a query to be used when retrieving data from a data source.
A Select models a query to be used when retrieving data from a DataSource.
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
A conteiner class for keeping information about a data source.
A dataset is the unit of information manipulated by the data access module of TerraLib.
The Field class can be used to model an expression that takes part of the output items of a SELECT...
It models the FROM clause for a query.
A class that represents a data source component.
This file contains include headers for the TerraLib Common Runtime module.
void setInputParams(const std::vector< te::vp::InputParams > &setInputParams)
The Fields class can be used to model a set of expressions that form the output items of a SELECT...
A template for atomic data types (integers, floats, strings and others).
This file contains several implementations for atomic data types (integers, floats, strings and others).
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
This file contains include headers for the Data Access module of TerraLib.
void setSpecificParams(const std::map< std::string, te::dt::AbstractData * > &specificParams)
void setFields(Fields *f)
It sets the list of output expressions used to form the result set.
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr
void setFrom(From *f)
It sets the list of source information.