35 #include "../../wcs/dataaccess/DataSource.h" 36 #include "../../../../core/translator/Translator.h" 37 #include "../../../../geometry/Envelope.h" 38 #include "../../../../raster/Grid.h" 39 #include "../../../../dataaccess/datasource/DataSourceFactory.h" 40 #include "../../../../dataaccess/dataset/DataSet.h" 41 #include "../../../../ws/ogc/wcs/client/WCSClient.h" 42 #include "../../../../datatype.h" 43 #include "../../../../raster/RasterProperty.h" 44 #include "../../../../raster/Grid.h" 45 #include "../../../../raster/BandProperty.h" 46 #include "../../../../common/StringUtils.h" 58 return m_wcs->describeCoverage(coverageName);
77 throw Exception(
TE_TR(
"The informed data set could not be found in the data source!"));
88 if (!dataSource->isOpened() || !dataSource->isValid())
89 throw Exception(
TE_TR(
"Fail to build Data Set. Data Source isn't valid or open!"));
91 std::string nameWithExtension = name +
".tif";
93 return dataSource->getDataSet(nameWithExtension);
97 const std::string& name,
const std::string& propertyName,
103 throw Exception(
TE_TR(
"The informed data set could not be found in the data source!"));
114 if (!dataSource->isOpened() || !dataSource->isValid())
115 throw Exception(
TE_TR(
"Fail to build Data Set. Data Source isn't valid or open!"));
117 std::string nameWithExtension = name +
".tif";
119 return dataSource->getDataSet(nameWithExtension, propertyName, e, r, travType, accessPolicy);
123 const std::string& propertyName,
130 return getDataSet(name, propertyName, g->
getMBR(), r, travType, connected, accessPolicy);
138 throw Exception(
TE_TR(
"The ObjectIdSet concept is not supported by the WCS driver!"));
145 throw Exception(
TE_TR(
"Query operations is not supported by the WCS driver!"));
152 throw Exception(
TE_TR(
"Query operations is not supported by the WCS driver!"));
157 return m_wcs->getCapabilities().coverages;
162 return m_wcs->getCapabilities().coverages.size();
168 throw Exception(
TE_TR(
"The informed data set could not be found in the data source!"));
184 if (!boundedBy.
srsName.empty())
186 int pos =
static_cast<int>(boundedBy.
srsName.find(
":"));
187 std::string sridStr = boundedBy.
srsName.substr(pos + 1);
189 srid = atoi(sridStr.c_str());
194 unsigned int width = 0;
195 unsigned int height = 0;
202 width = atoi(subSetX.
max.c_str());
203 height = atoi(subSetY.
max.c_str());
211 for(std::size_t i = 0; i < description.
fieldNames.size(); ++i)
219 return std::unique_ptr<te::da::DataSetType>(type);
224 boost::ptr_vector<te::dt::Property> properties;
226 std::unique_ptr<te::da::DataSetType> type =
getDataSetType(datasetName);
228 const std::vector<te::dt::Property*>& props = type->getProperties();
229 for(std::size_t i = 0; i < props.size(); ++i)
230 properties.push_back(props[i]->clone());
237 std::unique_ptr<te::da::DataSetType> type =
getDataSetType(datasetName);
239 const std::vector<te::dt::Property*>& props = type->getProperties();
240 for(std::size_t i = 0; i < props.size(); ++i)
242 if(props[i]->getName() == name)
243 return std::unique_ptr<te::dt::Property>(props[i]->clone());
246 throw Exception(
TE_TR(
"The informed property name could not be found in the data set."));
251 std::unique_ptr<te::da::DataSetType> type =
getDataSetType(datasetName);
253 const std::vector<te::dt::Property*>& props = type->getProperties();
255 if(propertyPos >= props.size())
256 throw Exception(
TE_TR(
"The informed property position could not be found in the data set."));
258 return std::unique_ptr<te::dt::Property>(props[propertyPos]->clone());
263 std::vector<std::string> propertyNames;
265 std::unique_ptr<te::da::DataSetType> type =
getDataSetType(datasetName);
267 const std::vector<te::dt::Property*>& props = type->getProperties();
268 for(std::size_t i = 0; i < props.size(); ++i)
269 propertyNames.push_back(props[i]->getName());
271 return propertyNames;
283 for(std::size_t i = 0; i < propertyNames.size(); ++i)
284 if(propertyNames[i] == name)
291 const std::string& propertyName)
293 std::unique_ptr<te::da::DataSetType> type =
getDataSetType(datasetName);
295 std::unique_ptr<te::dt::Property> prop =
getProperty(datasetName, propertyName);
303 return std::unique_ptr<te::gm::Envelope>();
307 std::size_t propertyPos)
309 std::unique_ptr<te::da::DataSetType> type =
getDataSetType(datasetName);
311 std::unique_ptr<te::dt::Property> prop =
getProperty(datasetName, propertyPos);
319 return std::unique_ptr<te::gm::Envelope>();
330 if(
m_wcs->getCapabilities().coverages.size() > 0)
338 std::vector< std::string > coverages =
m_wcs->getCapabilities().coverages;
340 for(
unsigned int i = 0; i < coverages.size(); i ++)
342 if(coverages.at(i).compare(name) == 0)
354 throw Exception(
TE_TR(
"The method begin() is not supported by the WCS driver!"));
359 throw Exception(
TE_TR(
"The method commit() is not supported by the WCS driver!"));
364 throw Exception(
TE_TR(
"The method rollBack() is not supported by the WCS driver!"));
369 throw Exception(
TE_TR(
"The method isInTransaction() is not supported by the WCS driver!"));
374 throw Exception(
TE_TR(
"The method execute() is not supported by the WCS driver!"));
379 throw Exception(
TE_TR(
"The method execute() is not supported by the WCS driver!"));
384 throw Exception(
TE_TR(
"The method getPrepared() is not supported by the WCS driver!"));
389 throw Exception(
TE_TR(
"The method getBatchExecutor() is not supported by the WCS driver!"));
394 throw Exception(
TE_TR(
"The method cancel() is not supported by the WCS driver!"));
399 throw Exception(
TE_TR(
"The method getLastGeneratedId() is not supported by the WCS driver!"));
404 throw Exception(
TE_TR(
"The method escape() is not supported by the WCS driver!"));
409 throw Exception(
TE_TR(
"The method isDataSetNameValid() is not supported by the WCS driver!"));
414 throw Exception(
TE_TR(
"The method isPropertyNameValid() is not supported by the WCS driver!"));
419 throw Exception(
TE_TR(
"The method addProperty() is not supported by the WCS driver!"));
424 throw Exception(
TE_TR(
"The method dropProperty() is not supported by the WCS driver!"));
429 throw Exception(
TE_TR(
"The method renameProperty() is not supported by the WCS driver!"));
434 throw Exception(
TE_TR(
"The method getPrimaryKey() is not supported by the WCS driver!"));
439 throw Exception(
TE_TR(
"The method primaryKeyExists() is not supported by the WCS driver!"));
444 throw Exception(
TE_TR(
"The method addPrimaryKey() is not supported by the WCS driver!"));
449 throw Exception(
TE_TR(
"The method dropPrimaryKey() is not supported by the WCS driver!"));
454 throw Exception(
TE_TR(
"The method getForeignKey() is not supported by the WCS driver!"));
459 throw Exception(
TE_TR(
"The method getForeignKeyNames() is not supported by the WCS driver!"));
464 throw Exception(
TE_TR(
"The method foreignKeyExists() is not supported by the WCS driver!"));
469 throw Exception(
TE_TR(
"The method addForeignKey() is not supported by the WCS driver!"));
474 throw Exception(
TE_TR(
"The method dropForeignKey() is not supported by the WCS driver!"));
479 throw Exception(
TE_TR(
"The method getUniqueKey() is not supported by the WCS driver!"));
484 throw Exception(
TE_TR(
"The method getUniqueKeyNames() is not supported by the WCS driver!"));
489 throw Exception(
TE_TR(
"The method uniqueKeyExists() is not supported by the WCS driver!"));
494 throw Exception(
TE_TR(
"The method addUniqueKey() is not supported by the WCS driver!"));
499 throw Exception(
TE_TR(
"The method dropUniqueKey() is not supported by the WCS driver!"));
504 throw Exception(
TE_TR(
"The method getCheckConstraint() is not supported by the WCS driver!"));
509 throw Exception(
TE_TR(
"The method getCheckConstraintNames() is not supported by the WCS driver!"));
514 throw Exception(
TE_TR(
"The method checkConstraintExists() is not supported by the WCS driver!"));
519 throw Exception(
TE_TR(
"The method addCheckConstraint() is not supported by the WCS driver!"));
524 throw Exception(
TE_TR(
"The method dropCheckConstraint() is not supported by the WCS driver!"));
529 throw Exception(
TE_TR(
"The method getIndex() is not supported by the WCS driver!"));
534 throw Exception(
TE_TR(
"The method getIndexNames() is not supported by the WCS driver!"));
539 throw Exception(
TE_TR(
"The method indexExists() is not supported by the WCS driver!"));
544 throw Exception(
TE_TR(
"The method addIndex() is not supported by the WCS driver!"));
549 throw Exception(
TE_TR(
"The method dropIndex() is not supported by the WCS driver!"));
554 throw Exception(
TE_TR(
"The method getSequence() is not supported by the WCS driver!"));
559 throw Exception(
TE_TR(
"The method getSequenceNames() is not supported by the WCS driver!"));
564 throw Exception(
TE_TR(
"The method sequenceExists() is not supported by the WCS driver!"));
569 throw Exception(
TE_TR(
"The method addSequence() is not supported by the WCS driver!"));
574 throw Exception(
TE_TR(
"The method dropSequence() is not supported by the WCS driver!"));
578 const std::map<std::string, std::string>& )
580 throw Exception(
TE_TR(
"The method createDataSet() is not supported by the WCS driver!"));
585 const std::map<std::string, std::string>& )
587 throw Exception(
TE_TR(
"The method cloneDataSet() is not supported by the WCS driver!"));
592 throw Exception(
TE_TR(
"The method dropDataSet() is not supported by the WCS driver!"));
598 throw Exception(
TE_TR(
"The method renameDataSet() is not supported by the WCS driver!"));
603 const std::map<std::string, std::string>& ,
607 throw Exception(
TE_TR(
"The method add() is not supported by the WCS driver!"));
612 throw Exception(
TE_TR(
"The method remove() is not supported by the WCS driver!"));
617 const std::vector<std::size_t>& ,
619 const std::map<std::string, std::string>& ,
622 throw Exception(
TE_TR(
"The method update() is not supported by the WCS driver!"));
627 throw Exception(
TE_TR(
"The method optimize() is not supported by the WCS driver!"));
void setTitle(const std::string &title)
It sets a human descriptive title for the DataSetType.
std::unique_ptr< te::dt::Property > getProperty(const std::string &datasetName, const std::string &name)
It retrieves the property with the given name from the dataset.
void dropIndex(const std::string &datasetName, const std::string &idxName)
It removes the index from the dataset schema.
std::size_t getNumberOfItems(const std::string &datasetName)
It retrieves the number of items of the given dataset.
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
void set(te::rst::Grid *grid)
Sets the definition of the raster grid support.
std::unique_ptr< te::da::PrimaryKey > getPrimaryKey(const std::string &datasetName)
It retrieves the primary key of the dataset.
void begin()
NOT SUPPORTED METHODS.
boost::int64_t getLastGeneratedId()
It returns the last id generated by an insertion command.
std::vector< std::string > getForeignKeyNames(const std::string &datasetName)
It gets the foreign key names of the given dataset.
std::vector< std::string > getCheckConstraintNames(const std::string &datasetName)
It gets the check constraint names of the given dataset.
std::unique_ptr< te::da::DataSetType > getDataSetType(const std::string &name)
It gets information about the given dataset.
te::da::DataSource * getDataSource() const
It returns the parent data source of the transactor.
std::unique_ptr< te::da::Sequence > getSequence(const std::string &name)
It gets the sequence with the given name in the data source.
void createDataSet(te::da::DataSetType *dt, const std::map< std::string, std::string > &options)
It creates the dataset schema definition in the target data source.
std::size_t getNumberOfDataSets()
It retrieves the number of data sets available in the data source.
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
void dropUniqueKey(const std::string &datasetName, const std::string &name)
It removes the unique key constraint from the dataset.
A raster band description.
Base exception class for plugin module.
A class that models the description of a dataset.
std::string lowerCorner_Y
void dropForeignKey(const std::string &datasetName, const std::string &fkName)
It removes the foreign key constraint from the dataset schema.
void add(const std::string &datasetName, te::da::DataSet *d, const std::map< std::string, std::string > &options, std::size_t limit=0, bool enableProgress=true)
It adds data items to the dataset in the data source.
CoverageDescription coverageDescription(const std::string coverageName)
void execute(const te::da::Query &command)
It executes the specified command using a generic query representation.
SpatialRelation
Spatial relations between geometric objects.
void addUniqueKey(const std::string &datasetName, te::da::UniqueKey *uk)
It adds a unique key constraint to the dataset.
It describes a sequence (a number generator).
std::vector< std::string > fieldNames
std::shared_ptr< te::ws::ogc::WCSClient > m_wcs
void addIndex(const std::string &datasetName, te::da::Index *idx, const std::map< std::string, std::string > &options)
It adds an index to the dataset.
A class that describes a check constraint.
bool primaryKeyExists(const std::string &datasetName, const std::string &name)
It checks if a primary key exists in the dataset.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
#define TE_TR(message)
It marks a string in order to get translated.
void dropDataSet(const std::string &name)
It removes the dataset schema from the data source.
bool hasDataSets()
It checks if the data source has any dataset.
It models a property definition.
std::vector< std::string > getIndexNames(const std::string &datasetName)
It gets the index names of the given dataset.
std::string upperCorner_X
void remove(const std::string &datasetName, const te::da::ObjectIdSet *oids=0)
It removes all the informed items from the dataset.
std::vector< std::string > getUniqueKeyNames(const std::string &datasetName)
It gets the unique key names of the given dataset.
boost::ptr_vector< te::dt::Property > getProperties(const std::string &datasetName)
It retrieves the properties of the dataset.
Transactor(const std::shared_ptr< te::ws::ogc::WCSClient > wcs)
std::unique_ptr< te::gm::Envelope > getExtent(const std::string &datasetName, const std::string &propertyName)
It retrieves the bounding rectangle of the spatial property for the given dataset.
std::vector< std::string > getDataSetNames()
It It gets the dataset names available in the data source.
void cancel()
It requests that the data source stop the processing of the current command.
std::vector< SubSet > subSet
AccessPolicy
Supported data access policies (can be used as bitfield).
TraverseType
A dataset can be traversed in two ways:
std::vector< std::string > getSequenceNames()
It gets the sequence names available in the data source.
std::size_t getNumberOfProperties(const std::string &datasetName)
It gets the number of properties of the given dataset.
void optimize(const std::map< std::string, std::string > &opInfo)
For some data access drivers, this method will perform some operations to optimize the data storage...
bool isPropertyNameValid(const std::string &propertyName)
It checks if the given property name is valid.
void add(te::rst::BandProperty *b)
It adds a new band information to the property.
bool sequenceExists(const std::string &name)
It checks if a sequence with the given name exists in the data source.
std::unique_ptr< te::da::BatchExecutor > getBatchExecutor()
It creates a batch command executor.
std::vector< std::string > getPropertyNames(const std::string &datasetName)
It gets the property names of the given dataset.
const Envelope * getMBR() const _NOEXCEPT_OP(true)
It returns the minimum bounding rectangle for the geometry in an internal representation.
void renameDataSet(const std::string &name, const std::string &newName)
It renames a dataset.
An Envelope defines a 2D rectangular region.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
void dropProperty(const std::string &datasetName, const std::string &name)
It removes a property from the given dataset.
void renameProperty(const std::string &datasetName, const std::string &propertyName, const std::string &newPropertyName)
It renames a property of the given dataset.
void dropSequence(const std::string &name)
It removes the sequence from the data source.
bool foreignKeyExists(const std::string &datasetName, const std::string &name)
It checks if a foreign key with the given name exists in the data source.
void update(const std::string &datasetName, te::da::DataSet *dataset, const std::vector< std::size_t > &properties, const te::da::ObjectIdSet *oids, const std::map< std::string, std::string > &options, std::size_t limit=0)
It updates the contents of a dataset for the set of data items.
It models a foreign key constraint for a DataSetType.
void addProperty(const std::string &datasetName, te::dt::Property *p)
It adds a new property to the dataset schema.
std::unique_ptr< te::da::DataSet > getDataSet(const std::string &name, te::common::TraverseType travType=te::common::FORWARDONLY, bool connected=false, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It gets the dataset identified by the given name. A dataset can be connected or disconnected. A connected dataset, after its creation through the data source transactor, continues to depend on the connection given by its associated data source. Differently, a disconnected dataset, after its creation, no more depends of the connection given by the data source, and it continues to live after the connection has been released to the data source.
bool indexExists(const std::string &datasetName, const std::string &name)
It checks if an index with the given name exists in the dataset.
It describes a unique key (uk) constraint.
std::unique_ptr< te::da::PreparedQuery > getPrepared(const std::string &qName=std::string(""))
It creates a prepared query object that may be used for query commands (select, insert, update and delete) that are used repeatedly.
std::unique_ptr< te::da::ForeignKey > getForeignKey(const std::string &datasetName, const std::string &name)
It retrieves the foreign key from the given dataset.
CoverageRequest m_coverageRequest
std::unique_ptr< te::da::UniqueKey > getUniqueKey(const std::string &datasetName, const std::string &name)
It gets the unique key in the dataset with the given name.
A struct to set the parameters of requested coverage.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
EnvelopeWithTimePeriod envelope
A Select models a query to be used when retrieving data from a DataSource.
std::string upperCorner_Y
void add(Constraint *c)
It adds a new constraint.
std::unique_ptr< te::da::DataSet > query(const te::da::Select &q, te::common::TraverseType travType=te::common::FORWARDONLY, bool connected=false, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It executes a query that may return some data using a generic query. A dataset can be connected or di...
A dataset is the unit of information manipulated by the data access module of TerraLib.
bool isDataSetNameValid(const std::string &datasetName)
It returns true if the given string is a valid dataset name.
void dropPrimaryKey(const std::string &datasetName)
It removes the primary key constraint from the dataset schema.
void setCoverageRequest(const te::ws::ogc::wcs::CoverageRequest coverageRequest)
It describes a primary key (pk) constraint.
void addForeignKey(const std::string &datasetName, te::da::ForeignKey *fk)
It adds a foreign key constraint to a dataset.
std::string lowerCorner_X
bool uniqueKeyExists(const std::string &datasetName, const std::string &name)
It checks if a unique key with the given name exists in the dataset.
void dropCheckConstraint(const std::string &datasetName, const std::string &name)
It removes the check constraint from the dataset.
void rollBack()
It aborts the transaction. Any changes will be rolled-back.
void commit()
It commits the transaction.
std::unique_ptr< te::da::Index > getIndex(const std::string &datasetName, const std::string &name)
It gets the index with the given name from the dataset.
void addPrimaryKey(const std::string &datasetName, te::da::PrimaryKey *pk)
It adds a primary key constraint to the dataset schema.
bool dataSetExists(const std::string &name)
It checks if a dataset with the given name exists in the data source.
bool checkConstraintExists(const std::string &datasetName, const std::string &name)
It checks if a check-constraint with the given name exists in the data source.
std::string escape(const std::string &value)
It escapes a string for using in commands and queries.
void addCheckConstraint(const std::string &datasetName, te::da::CheckConstraint *cc)
It adds a check constraint to the dataset.
void addSequence(te::da::Sequence *sequence)
It creates a new sequence in the data source.
A rectified grid is the spatial support for raster data.
bool propertyExists(const std::string &datasetName, const std::string &name)
It checks if a property with the given name exists in the dataset.
bool isInTransaction() const
It returns true if a transaction is in progress, otherwise, it returns false.
A Query is independent from the data source language/dialect.
void cloneDataSet(const std::string &name, const std::string &cloneName, const std::map< std::string, std::string > &options)
It clones the dataset in the data source.
It describes an index associated to a DataSetType.
std::unique_ptr< te::da::CheckConstraint > getCheckConstraint(const std::string &datasetName, const std::string &name)
It gets the check constraint of the dataset with the given name.
Implementation of the transactor for the WS OGC WCS.