16 std::string data_dir = TERRALIB_DATA_DIR;
18 std::string filename1(data_dir +
"shp/Intersection/rodovias.shp");
20 std::string srcInfo1(
"file://" + filename1);
25 std::string inDsetName1 =
"rodovias";
26 if (!srcDs1->dataSetExists(inDsetName1))
28 std::cout <<
"Input dataset not found: " << inDsetName1 << std::endl;
32 std::unique_ptr<te::da::DataSet> inDset1 = srcDs1->getDataSet(inDsetName1);
33 std::unique_ptr<te::da::DataSetType> inDsetType1 = srcDs1->getDataSetType(inDsetName1);
35 std::string filename2(data_dir +
"/shape/Intersection/SP_meso.shp");
36 std::string srcInfo2 (
"file://" + srcInfo1);
41 std::string inDsetName2 =
"SP_meso";
42 if (!srcDs2->dataSetExists(inDsetName2))
44 std::cout <<
"Input dataset not found: " << inDsetName2 << std::endl;
48 std::unique_ptr<te::da::DataSet> inDset2 = srcDs2->getDataSet(inDsetName2);
49 std::unique_ptr<te::da::DataSetType> inDsetType2 = srcDs2->getDataSetType(inDsetName2);
51 std::vector<int> inSRID;
53 std::string filenameResult(data_dir +
"/shape/Intersection/intersectionOGR2OGR.shp");
55 std::string tgrInfo(
"file://" + filenameResult);
60 std::string outDS =
"intersectionOGR2OGR";
62 if (trgDs->dataSetExists(outDS))
64 std::cout <<
"A dataset with the same requested output dataset name already exists: " << outDS << std::endl;
68 std::unique_ptr<te::da::DataSetTypeConverter> firstConverter(
new te::da::DataSetTypeConverter(inDsetType1.get(), trgDs->getCapabilities(), trgDs->getEncoding()));
69 std::unique_ptr<te::da::DataSetTypeConverter> secondConverter(
new te::da::DataSetTypeConverter(inDsetType2.get(), trgDs->getCapabilities(), trgDs->getEncoding()));
74 intersectionOp->
setInput(srcDs1, inDsetName1, std::move(firstConverter), srcDs2, inDsetName2, std::move(secondConverter));
82 result = intersectionOp->
run();
84 delete intersectionOp;
92 std::string data_dir = TERRALIB_DATA_DIR;
94 std::string filename1(data_dir +
"/shape/Intersection/rodovias.shp");
95 std::string srcInfo1 (
"file://" + filename1);
100 std::string inDsetName1 =
"rodovias";
101 if (!srcDs1->dataSetExists(inDsetName1))
103 std::cout <<
"Input dataset not found: " << inDsetName1 << std::endl;
107 std::unique_ptr<te::da::DataSet> inDset1 = srcDs1->getDataSet(inDsetName1);
108 std::unique_ptr<te::da::DataSetType> inDsetType1 = srcDs1->getDataSetType(inDsetName1);
111 std::string filename2(data_dir +
"/shape/Intersection/SP_meso.shp");
112 std::string srcInfo2(
"file://" + filename2);
117 std::string inDsetName2 =
"SP_meso";
118 if (!srcDs2->dataSetExists(inDsetName2))
120 std::cout <<
"Input dataset not found: " << inDsetName2 << std::endl;
124 std::unique_ptr<te::da::DataSet> inDset2 = srcDs2->getDataSet(inDsetName2);
125 std::unique_ptr<te::da::DataSetType> inDsetType2 = srcDs2->getDataSetType(inDsetName2);
127 std::vector<int> inSRID;
128 std::string connInfo(
"ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS");
133 std::string outDS =
"intersectionOGR2PGIS";
135 if (trgDs->dataSetExists(outDS))
137 std::cout <<
"A dataset with the same requested output dataset name already exists: " << outDS << std::endl;
141 std::unique_ptr<te::da::DataSetTypeConverter> firstConverter(
new te::da::DataSetTypeConverter(inDsetType1.get(), trgDs->getCapabilities(), trgDs->getEncoding()));
142 std::unique_ptr<te::da::DataSetTypeConverter> secondConverter(
new te::da::DataSetTypeConverter(inDsetType2.get(), trgDs->getCapabilities(), trgDs->getEncoding()));
147 intersectionOp->
setInput(srcDs1, inDsetName1, std::move(firstConverter), srcDs2, inDsetName2, std::move(secondConverter));
156 result = intersectionOp->
run();
158 delete intersectionOp;
166 std::string connInfo(
"ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS");
170 std::string inDsetName1 =
"rodovias";
171 if (!srcDs1->dataSetExists(inDsetName1))
173 std::cout <<
"Input dataset not found: " << inDsetName1 << std::endl;
177 std::unique_ptr<te::da::DataSet> inDset1 = srcDs1->getDataSet(inDsetName1);
178 std::unique_ptr<te::da::DataSetType> inDsetType1 = srcDs1->getDataSetType(inDsetName1);
183 std::string inDsetName2 =
"sp_nomemeso";
184 if (!srcDs2->dataSetExists(inDsetName2))
186 std::cout <<
"Input dataset not found: " << inDsetName2 << std::endl;
190 std::unique_ptr<te::da::DataSet> inDset2 = srcDs2->getDataSet(inDsetName2);
191 std::unique_ptr<te::da::DataSetType> inDsetType2 = srcDs2->getDataSetType(inDsetName2);
193 std::vector<int> inSRID;
198 std::string outDS =
"intersectionPGIS2PGIS";
200 if (trgDs->dataSetExists(outDS))
202 std::cout <<
"A dataset with the same requested output dataset name already exists: " << outDS << std::endl;
206 std::unique_ptr<te::da::DataSetTypeConverter> firstConverter(
new te::da::DataSetTypeConverter(inDsetType1.get(), trgDs->getCapabilities(), trgDs->getEncoding()));
207 std::unique_ptr<te::da::DataSetTypeConverter> secondConverter(
new te::da::DataSetTypeConverter(inDsetType2.get(), trgDs->getCapabilities(), trgDs->getEncoding()));
212 intersectionOp->
setInput(srcDs1, inDsetName1, std::move(firstConverter), srcDs2, inDsetName2, std::move(secondConverter));
220 result = intersectionOp->
run();
222 delete intersectionOp;
230 std::string connInfo(
"ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS");
235 std::string inDsetName1 =
"rodovias";
236 if (!srcDs1->dataSetExists(inDsetName1))
238 std::cout <<
"Input dataset not found: " << inDsetName1 << std::endl;
242 std::unique_ptr<te::da::DataSet> inDset1 = srcDs1->getDataSet(inDsetName1);
243 std::unique_ptr<te::da::DataSetType> inDsetType1 = srcDs1->getDataSetType(inDsetName1);
248 std::string inDsetName2 =
"sp_meso";
249 if (!srcDs2->dataSetExists(inDsetName2))
251 std::cout <<
"Input dataset not found: " << inDsetName2 << std::endl;
255 std::unique_ptr<te::da::DataSet> inDset2 = srcDs2->getDataSet(inDsetName2);
256 std::unique_ptr<te::da::DataSetType> inDsetType2 = srcDs2->getDataSetType(inDsetName2);
258 std::vector<int> inSRID;
260 std::string outDSet =
"intersectionPGIS2OGR";
262 std::string data_dir = TERRALIB_DATA_DIR;
264 std::string uriResult(data_dir +
"/shape/Intersection/intersectionPGIS2OGR.shp");
266 std::string tgrInfo (
"file://" + uriResult);
271 if (trgDs->dataSetExists(outDSet))
273 std::cout <<
"A dataset with the same requested output dataset name already exists: " << outDSet << std::endl;
277 std::unique_ptr<te::da::DataSetTypeConverter> firstConverter(
new te::da::DataSetTypeConverter(inDsetType1.get(), trgDs->getCapabilities(), trgDs->getEncoding()));
278 std::unique_ptr<te::da::DataSetTypeConverter> secondConverter(
new te::da::DataSetTypeConverter(inDsetType2.get(), trgDs->getCapabilities(), trgDs->getEncoding()));
283 intersectionOp->
setInput(srcDs1, inDsetName1, std::move(firstConverter), srcDs2, inDsetName2, std::move(secondConverter));
284 intersectionOp->
setOutput(trgDs, outDSet);
292 result = intersectionOp->
run();
294 delete intersectionOp;
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
boost::shared_ptr< DataSource > DataSourcePtr
Intersection Vector Processing functions.
void setInput(te::da::DataSourcePtr inFirstDsrc, std::string inFirstDsetName, std::unique_ptr< te::da::DataSetTypeConverter > firstConverter, te::da::DataSourcePtr inSecondDsrc, std::string inSecondDsetName, std::unique_ptr< te::da::DataSetTypeConverter > secondConverter, const te::da::ObjectIdSet *firstOidSet=0, const te::da::ObjectIdSet *secondOidSet=0)
virtual bool paramsAreValid()
An converter for DataSetType.
Intersection Vector Processing functions.
bool IntersectionOGRToOGR()
void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname)
bool IntersectionOGRToPGIS()
bool IntersectionPGISToOGR()
This file contains include headers for the TerraLib Common Runtime module.
This file contains include headers for the Data Access module of TerraLib.
bool IntersectionPGISToPGIS()