27 #include "../Config.h" 54 #include <boost/uuid/random_generator.hpp> 55 #include <boost/uuid/uuid_io.hpp> 83 catch (
const std::exception& e)
85 std::cout <<
"Error: " << e.what() << std::endl;
89 std::cout <<
"Unexpected error" << std::endl;
96 catch(
const std::exception& e)
98 std::cout << std::endl <<
"An exception has occurred: " << e.what() << std::endl;
104 std::cout << std::endl <<
"An unexpected exception has occurred!" << std::endl;
114 std::string data_dir = TERRALIB_DATA_DIR;
115 std::string filename(data_dir +
"/shape/Intersection/brazil_cells.shp");
116 std::string ogrInfo(
"file://" + filename);
118 boost::uuids::basic_random_generator<boost::mt19937> gen;
119 boost::uuids::uuid u = gen();
120 std::string id_ds = boost::uuids::to_string(u);
123 ds->setConnInfo(ogrInfo);
124 ds->setAccessDriver(
"OGR");
141 boost::uuids::basic_random_generator<boost::mt19937> gen;
142 boost::uuids::uuid u = gen();
144 std::string id_source = boost::uuids::to_string(u);
146 std::string data_dir = TERRALIB_DATA_DIR;
148 std::string connInfo(
"file://");
149 connInfo += data_dir +
"/shp/munic_2001.shp";
153 source->setId(id_source);
159 std::unique_ptr<te::da::DataSetType> dsType = source->getDataSetType(
"munic_2001");
160 std::unique_ptr<te::da::DataSet> dataset = source->getDataSet(
"munic_2001");
165 std::string id_layer = boost::uuids::to_string(u);
167 std::unique_ptr<te::gm::Envelope> mbr(
te::da::GetExtent(dsType->getName(), gp->getName(), id_source));
170 layer->setDataSetName(dsType->getName());
171 layer->setDataSourceId(id_source);
173 layer->setRendererType(
"ABSTRACT_LAYER_RENDERER");
174 layer->setSRID(gp->getSRID());
177 layer->setExtent(*mbr);
179 std::string data_dir = TERRALIB_DATA_DIR;
180 std::string filename(data_dir +
"/shape/Intersection/brazil_cells_mask.shp");
181 std::string ogrInfo(
"file://" + filename);
183 std::string id_source = boost::uuids::to_string(u);
186 ds->setConnInfo(ogrInfo);
187 ds->setAccessDriver(
"OGR");
188 ds->setId(id_source);
This class provide cellular spaces operations.
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
An utility class to control the startup and cleanup of the TerraLib Platform and its resources...
TEDATAACCESSEXPORT te::gm::Envelope * GetExtent(const std::string &datasetName, const std::string &propertyName, const std::string &datasourceId)
Include files for Core Plugin Library.
It describes a primary key (pk) constraint.
void LoadModules()
Load terralib modules.
boost::shared_ptr< DataSource > DataSourcePtr
This is a singleton for managing all data source instances available in the system.
double m_urx
Upper right corner x-coordinate.
static te::dt::Date ds(2010, 01, 01)
A layer with reference to a dataset.
A singleton to keep all the registered data sources.
It describes an index associated to a DataSetType.
static PluginManager & instance()
Access the singleton.
double m_llx
Lower left corner x-coordinate.
An Envelope defines a 2D rectangular region.
void finalize()
It finalizes the TerraLib Platform.
static TerraLib & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
void CreateMaskCellSpace()
A factory for data sources.
Utility functions for the data access module.
void initialize()
It initializes the TerraLib Platform.
double m_lly
Lower left corner y-coordinate.
A conteiner class for keeping information about a data source.
A class that describes a check constraint.
double m_ury
Upper right corner y-coordinate.
A class that represents a data source component.
A layer with reference to a dataset.
void clear()
Stop and unload all plugins, then clear the internal list of plugins.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
void createCellSpace(te::da::DataSourceInfoPtr outputSource, const std::string &name, const double &resX, const double &resY, const te::gm::Envelope &env, const int srid, CellSpaceType type, te::map::AbstractLayerPtr layerBase)
It creates a Cellular Space.
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr