9 #include <boost/uuid/random_generator.hpp> 10 #include <boost/uuid/uuid_io.hpp> 18 std::string data_dir = TERRALIB_DATA_DIR;
20 std::string input_filename(data_dir +
"/shape/munic_goias.shp");
21 std::string srcInputInfo (
"file://" + input_filename);
23 std::string intersection_filename(data_dir +
24 "/shape/munic_goias_selected.shp");
25 std::string srcIntersectionInfo (
"file://" + intersection_filename);
34 srcIntersectionDs->open();
37 std::string input_DsetName =
"munic_goias";
38 std::string intersection_DsetName =
"munic_goias_selected";
40 if (!srcInputDs->dataSetExists(input_DsetName))
42 std::cout <<
"Input dataset not found: " << input_DsetName << std::endl;
46 std::unique_ptr<te::da::DataSet> input_Dset =
47 srcInputDs->getDataSet(input_DsetName);
49 std::unique_ptr<te::da::DataSetType> input_DsetType =
50 srcInputDs->getDataSetType(input_DsetName);
52 if (!srcIntersectionDs->dataSetExists(intersection_DsetName))
54 std::cout <<
"Input dataset not found: " << intersection_DsetName
59 std::unique_ptr<te::da::DataSet> intersection_Dset =
60 srcIntersectionDs->getDataSet(intersection_DsetName);
62 std::unique_ptr<te::da::DataSetType> intersection_DsetType =
63 srcIntersectionDs->getDataSetType(intersection_DsetName);
65 std::vector<std::string> attributes;
66 attributes.push_back(
"nome");
67 attributes.push_back(
"nomemeso");
69 std::map<std::string, te::dt::AbstractData*> specificParams;
70 specificParams[
"munic_goias"] =
72 specificParams[
"munic_goias_selected"] =
75 std::string output_filename(data_dir +
"/shape/identity_shptoshp_ex.shp");
76 std::string tgrInfo (
"file://" + output_filename);
81 std::string outDSName =
"identity_shptoshp_ex";
83 if (trgDs->dataSetExists(outDSName))
85 std::cout <<
"A dataset with the same requested output dataset name " 86 "already exists:" << outDSName << std::endl;
90 std::vector<te::vp::InputParams> inputParamsVec;
100 structIntersectionParams.
m_inputDataSet = intersection_Dset.release();
102 inputParamsVec.push_back(structInputParams);
103 inputParamsVec.push_back(structIntersectionParams);
122 std::string data_dir = TERRALIB_DATA_DIR;
124 std::string input_filename(data_dir +
"/shape/munic_goias.shp");
125 std::string srcInputInfo (
"file://" + input_filename);
127 std::string intersection_filename(data_dir +
128 "/shape/munic_goias_selected.shp");
129 std::string srcIntersectionInfo (
"file://" + intersection_filename);
138 srcIntersectionDs->open();
141 std::string input_DsetName =
"munic_goias";
142 std::string intersection_DsetName =
"munic_goias_selected";
144 if (!srcInputDs->dataSetExists(input_DsetName))
146 std::cout <<
"Input dataset not found: " << input_DsetName << std::endl;
150 std::unique_ptr<te::da::DataSet> input_Dset =
151 srcInputDs->getDataSet(input_DsetName);
153 std::unique_ptr<te::da::DataSetType> input_DsetType =
154 srcInputDs->getDataSetType(input_DsetName);
156 if (!srcIntersectionDs->dataSetExists(intersection_DsetName))
158 std::cout <<
"Input dataset not found: " << intersection_DsetName
163 std::unique_ptr<te::da::DataSet> intersection_Dset =
164 srcIntersectionDs->getDataSet(intersection_DsetName);
166 std::unique_ptr<te::da::DataSetType> intersection_DsetType =
167 srcIntersectionDs->getDataSetType(intersection_DsetName);
169 std::vector<std::string> attributes;
170 attributes.push_back(
"nome");
171 attributes.push_back(
"nomemeso");
173 std::map<std::string, te::dt::AbstractData*> specificParams;
174 specificParams[
"munic_goias"] =
176 specificParams[
"munic_goias_selected"] =
179 std::string connInfo(
180 "ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS");
186 std::string outDSName =
"identity_shptopgis_ex";
188 if (trgDs->dataSetExists(outDSName))
190 std::cout <<
"A dataset with the same requested output dataset name " 191 "already exists:" << outDSName << std::endl;
195 std::vector<te::vp::InputParams> inputParamsVec;
205 structIntersectionParams.
m_inputDataSet = intersection_Dset.release();
207 inputParamsVec.push_back(structInputParams);
208 inputParamsVec.push_back(structIntersectionParams);
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 input_DsetName =
"munic_goias";
248 std::string intersection_DsetName =
"munic_goias_selected";
250 if (!srcDs->dataSetExists(input_DsetName))
252 std::cout <<
"Input dataset not found: " << input_DsetName << std::endl;
256 std::unique_ptr<te::da::DataSet> input_Dset =
257 srcDs->getDataSet(input_DsetName);
259 std::unique_ptr<te::da::DataSetType> input_DsetType =
260 srcDs->getDataSetType(input_DsetName);
262 if (!srcDs->dataSetExists(intersection_DsetName))
264 std::cout <<
"Input dataset not found: " << intersection_DsetName
269 std::unique_ptr<te::da::DataSet> intersection_Dset =
270 srcDs->getDataSet(intersection_DsetName);
272 std::unique_ptr<te::da::DataSetType> intersection_DsetType =
273 srcDs->getDataSetType(intersection_DsetName);
275 std::vector<std::string> attributes;
276 attributes.push_back(
"nome");
277 attributes.push_back(
"nomemeso");
279 std::map<std::string, te::dt::AbstractData*> specificParams;
280 specificParams[
"public.munic_goias"] =
282 specificParams[
"public.munic_goias_selected"] =
289 std::string outDSName =
"identity_pgistopgis_ex";
291 if (trgDs->dataSetExists(outDSName))
293 std::cout <<
"A dataset with the same requested output dataset name " 294 "already exists:" << outDSName << std::endl;
298 std::vector<te::vp::InputParams> inputParamsVec;
308 structIntersectionParams.
m_inputDataSet = intersection_Dset.release();
310 inputParamsVec.push_back(structInputParams);
311 inputParamsVec.push_back(structIntersectionParams);
330 boost::uuids::basic_random_generator<boost::mt19937> gen;
331 boost::uuids::uuid u = gen();
332 std::string dsId = boost::uuids::to_string(u);
334 std::string connInfo(
335 "ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS");
342 dsInfoPtr->setId(dsId);
343 dsInfoPtr->setConnInfo(connInfo);
344 dsInfoPtr->setType(
"POSTGIS");
350 std::string input_DsetName =
"munic_goias";
351 std::string intersection_DsetName =
"munic_goias_selected";
353 if (!srcDs->dataSetExists(input_DsetName))
355 std::cout <<
"Input dataset not found: " << input_DsetName << std::endl;
359 std::unique_ptr<te::da::DataSet> input_Dset =
360 srcDs->getDataSet(input_DsetName);
362 std::unique_ptr<te::da::DataSetType> input_DsetType =
363 srcDs->getDataSetType(input_DsetName);
366 if (!srcDs->dataSetExists(intersection_DsetName))
368 std::cout <<
"Input dataset not found: " << intersection_DsetName
373 std::unique_ptr<te::da::DataSet> intersection_Dset =
374 srcDs->getDataSet(intersection_DsetName);
376 std::unique_ptr<te::da::DataSetType> intersection_DsetType =
377 srcDs->getDataSetType(intersection_DsetName);
379 std::vector<std::string> attributes;
380 attributes.push_back(
"nome");
381 attributes.push_back(
"nomemeso");
383 std::map<std::string, te::dt::AbstractData*> specificParams;
384 specificParams[
"public.munic_goias"] =
386 specificParams[
"public.munic_goias_selected"] =
389 std::string data_dir = TERRALIB_DATA_DIR;
390 std::string output_filename(data_dir +
"/shape/identity_pgistoshp_ex.shp");
391 std::string tgrInfo (
"file://" + output_filename);
396 std::string outDSName =
"identity_pgistoshp_ex";
398 if (trgDs->dataSetExists(outDSName))
400 std::cout <<
"A dataset with the same requested output dataset name " 401 "already exists:" << outDSName << std::endl;
405 std::vector<te::vp::InputParams> inputParamsVec;
415 structIntersectionParams.
m_inputDataSet = intersection_Dset.release();
417 inputParamsVec.push_back(structInputParams);
418 inputParamsVec.push_back(structIntersectionParams);
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
boost::shared_ptr< DataSource > DataSourcePtr
void setOutputDataSetName(const std::string &outputDataSetName)
void setOutputDataSource(te::da::DataSourcePtr outputDataSource)
A singleton to keep all the registered data sources.
bool executeMemory(te::vp::AlgorithmParams *mainParams)
A template for complex data types.
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance.
A factory for data sources.
bool IdentityPGISToPGIS()
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)
void setSpecificParams(const std::map< std::string, te::dt::AbstractData * > &specificParams)
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr