21 std::string data_dir = TERRALIB_DATA_DIR;
23 std::string filename = data_dir +
"/shape/Buffer/SP_meso.shp";
25 std::string srcInfo(
"file://" + filename);
30 std::string inDsetName =
"SP_meso";
31 if (!srcDs->dataSetExists(inDsetName))
33 std::cout <<
"Input dataset not found: " << inDsetName << std::endl;
37 std::unique_ptr<te::da::DataSetType> inDsetType = srcDs->getDataSetType(inDsetName);
40 std::unique_ptr<te::da::DataSetTypeConverter> converter(
new te::da::DataSetTypeConverter(inDsetType.get(), srcDs->getCapabilities(), srcDs->getEncoding()));
42 double distance = 0.1;
53 bool copyInputColumns =
false;
56 std::string file_result = data_dir +
"/shape/Buffer/file_result.shp";
57 std::string tgrInfo(
"file://" + file_result);
62 std::string outDS =
"file_result";
64 if (trgDs->dataSetExists(outDS))
66 std::cout <<
"A dataset with the same requested output dataset name already exists: " << outDS << std::endl;
73 bufferOp->
setInput(srcDs, inDsetName, std::move(converter));
87 result = bufferOp->
run();
97 std::string data_dir = TERRALIB_DATA_DIR;
99 std::string filename(data_dir +
"/shape/Buffer/SP_meso.shp");
100 std::string srcInfo(
"file://" + filename);
105 std::string inDsetName =
"SP_meso";
106 if (!srcDs->dataSetExists(inDsetName))
108 std::cout <<
"Input dataset not found: " << inDsetName << std::endl;
112 std::unique_ptr<te::da::DataSet> inDset = srcDs->getDataSet(inDsetName);
113 std::unique_ptr<te::da::DataSetType> inDsetType = srcDs->getDataSetType(inDsetName);
116 std::unique_ptr<te::da::DataSetTypeConverter> converter(
new te::da::DataSetTypeConverter(inDsetType.get(), srcDs->getCapabilities(), srcDs->getEncoding()));
118 double distance = 0.1;
129 bool copyInputColumns =
false;
132 std::string connInfo(
"ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS?PG_CONNECT_TIMEOUT=4&PG_CLIENT_ENCODING=UTF-8");
137 std::string outDS =
"result";
139 if (trgDs->dataSetExists(outDS))
141 std::cout <<
"A dataset with the same requested output dataset name already exists: " << outDS << std::endl;
148 bufferOp->
setInput(srcDs, inDsetName, std::move(converter));
153 bufferBoundariesRule,
162 result = bufferOp->
run();
172 std::string connInfo(
"ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS?PG_CONNECT_TIMEOUT=4&PG_CLIENT_ENCODING=UTF-8");
176 std::string inDsetName =
"sp_meso";
177 if (!srcDs->dataSetExists(inDsetName))
179 std::cout <<
"Input dataset not found: " << inDsetName << std::endl;
183 std::unique_ptr<te::da::DataSet> inDset = srcDs->getDataSet(inDsetName);
184 std::unique_ptr<te::da::DataSetType> inDsetType = srcDs->getDataSetType(inDsetName);
187 std::unique_ptr<te::da::DataSetTypeConverter> converter(
new te::da::DataSetTypeConverter(inDsetType.get(), srcDs->getCapabilities(), srcDs->getEncoding()));
189 std::string outDSet =
"bufferPGISToPGIS";
191 double distance = 0.1;
199 bool copyInputColumns =
false;
205 if (outDsource->dataSetExists(outDSet))
207 std::cout <<
"A dataset with the same requested output dataset name already exists: " << outDSet << std::endl;
214 bufferOp->
setInput(srcDs, inDsetName, std::move(converter));
215 bufferOp->
setOutput(outDsource, outDSet);
219 bufferBoundariesRule,
228 result = bufferOp->
run();
238 std::string connInfo(
"ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS?PG_CONNECT_TIMEOUT=4&PG_CLIENT_ENCODING=UTF-8");
243 std::string inDsetName =
"distritos";
244 if (!srcDs->dataSetExists(inDsetName))
246 std::cout <<
"Input dataset not found: " << inDsetName << std::endl;
250 std::unique_ptr<te::da::DataSet> inDset = srcDs->getDataSet(inDsetName);
251 std::unique_ptr<te::da::DataSetType> inDsetType = srcDs->getDataSetType(inDsetName);
254 std::unique_ptr<te::da::DataSetTypeConverter> converter(
new te::da::DataSetTypeConverter(inDsetType.get(), srcDs->getCapabilities(), srcDs->getEncoding()));
256 double distance = 0.1;
264 bool copyInputColumns =
false;
267 std::string data_dir = TERRALIB_DATA_DIR;
269 std::string uriResult(data_dir +
"/shape/Buffer/bufferPGISToOGR_distritos.shp");
271 std::string tgrInfo(
"file://" + uriResult);
276 std::string outDSet =
"bufferPGISToOGR_distritos";
278 if (trgDs->dataSetExists(outDSet))
280 std::cout <<
"A dataset with the same requested output dataset name already exists and will be removed: " << outDSet << std::endl;
281 trgDs->dropDataSet(outDSet);
288 bufferOp->
setInput(srcDs, inDsetName, std::move(converter));
293 bufferBoundariesRule,
302 result = bufferOp->
run();
Buffer Vector Processing functions.
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
virtual bool run()=0
It executes the operation.
boost::shared_ptr< DataSource > DataSourcePtr
The boundaries between buffers will not be dissolved.
An abstract class to compute the buffer memory and buffer query operation.
void setParams(const double &distance, const int &newSrid, const int &bufferPolygonRule, const int &bufferBoundariesRule, const bool ©InputColumns, const int &levels, const int &attributePosition=-1)
It sets the input parameters that will be consumed to execute the operation.
Buffer Vector Processing functions.
void setInput(te::da::DataSourcePtr inDsrc, std::string inDsetName, std::unique_ptr< te::da::DataSetTypeConverter > converter, const te::da::ObjectIdSet *oidSet=0)
It sets the input data will be calculated.
An converter for DataSetType.
int getSRID() const
It returns the spatial reference system identifier associated to this property.
A factory for data sources.
virtual bool paramsAreValid()
It verifies if the parameters are valid.
A concrete class to compute the buffer operation.
void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname)
It sets the output parameters that will be used to persist operation result.
The buffer is generated Inside and outside of the polygons.
This file contains include headers for the TerraLib Common Runtime module.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
This file contains include headers for the Data Access module of TerraLib.
A concrete class to compute the buffer operation.
The boundaries between buffers will be dissolved.