17 #include <boost/filesystem.hpp> 18 #include <boost/uuid/random_generator.hpp> 19 #include <boost/uuid/uuid_io.hpp> 24 std::string filename(TERRALIB_DATA_DIR
"/shape/SP_cities.shp");
26 std::string srcInfo(
"file://" + filename);
31 std::string inDset =
"SP_cities";
32 if (!srcDs->dataSetExists(inDset))
34 std::cout <<
"input dataset not found: " << inDset << std::endl;
38 std::unique_ptr<te::da::DataSetType> dsType(srcDs->getDataSetType(inDset));
39 std::vector<te::dt::Property*> props = dsType->getProperties();
41 std::vector<std::string> propName;
44 for (std::size_t i = 0; i < props.size(); ++i)
46 if (props[i]->getName() ==
"FID" || props[i]->getName() ==
"POPULACA")
47 propName.push_back(props[i]->getName());
50 double resolutionX = 0.0111898;
51 double resolutionY = 0.00868972;
55 boost::filesystem::path uri(TERRALIB_DATA_DIR
"/geotiff/vector2raster.tif");
56 std::string dsName =
"vector2raster";
60 std::cout <<
"Output file already exists. Remove it or select a new name and try again.";
64 std::string dsinfo(
"file://" + uri.string());
67 if (dsOGR->dataSetExists(dsName))
69 std::cout <<
"There is already a dataset with the requested name in the output data source. Remove it or select a new name and try again.";
73 std::unique_ptr<te::da::DataSetTypeConverter> converterVector(
new te::da::DataSetTypeConverter(dsType.get(), dsOGR->getCapabilities(), dsOGR->getEncoding()));
77 vec2rst->
setInput(srcDs, inDset, std::move(converterVector));
96 std::cout <<
"Error: could not generate the operation.";
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
static bool exists(const std::string &path)
Checks if a given path in UTF-8 exists.
boost::shared_ptr< DataSource > DataSourcePtr
An converter for DataSetType.
void setInput(te::da::DataSourcePtr inVectorDsrc, std::string inVectorName, std::unique_ptr< te::da::DataSetTypeConverter > inVectorDsType)
A class for handling system files and paths.
A factory for data sources.
Vector to Raster processing.
void setParams(std::vector< std::string > selectedAttVec, double resolutionX, double resolutionY, int columns, int rows, bool useDummy, int dummy=0)
This file contains include headers for the TerraLib Common Runtime module.
This file contains include headers for the Data Access module of TerraLib.
void setOutput(te::da::DataSourcePtr outDsrc, std::string dsName)