22 #include <boost/foreach.hpp> 27 void openFile(
const std::string& filename,
const std::string dstype);
28 void openDirectory(
const std::string& filename,
const std::string dstype);
29 void saveUsingOGR(
const std::string& filename,
const std::string drivername);
33 std::string data_dir = TERRALIB_DATA_DIR;
35 std::cout <<
"Inform a directory to write the data generated\n(ENTER to access the default \'" << TERRALIB_DATA_DIR <<
"/shape\'): ";
36 std::getline (std::cin, aux);
40 saveUsingOGR(data_dir +
"/shape/testeOGR.shp",
"ESRI Shapefile");
42 saveUsingOGR(data_dir +
"/shape/testeOGR.mif",
"MapInfo File");
43 saveUsingOGR(data_dir +
"/shape/testeOGR.geojson",
"GeoJSON");
46 std::cout << std::endl <<
"Checking the directory: \n" << data_dir;
50 void openFile(
const std::string& filename,
const std::string dstype)
52 std::string connInfo(
"file://");
58 std::vector<std::string> dsNames = dsptr->getDataSetNames();
60 std::cout << std::endl <<
"Datasets in " << filename <<
":" << std::endl;
62 BOOST_FOREACH(std::string s, dsNames)
64 std::cout <<
"\t" <<
"\t" << s << std::endl;
70 void openDirectory(
const std::string& filename,
const std::string dstype)
72 std::string connInfo(
"file://");
78 std::vector<std::string> dsNames = dsptr->getDataSetNames();
80 std::cout << std::endl <<
"Datasets in " << filename <<
":" << std::endl;
82 BOOST_FOREACH(std::string s, dsNames)
84 std::cout <<
"\t" <<
"\t" << s << std::endl;
90 void saveUsingOGR(
const std::string& filename,
const std::string drivername)
112 std::unique_ptr<te::da::DataSet> dataset(
create_ds_memory(
"teste10", dt.get()));
114 std::string connInfo(
"file://");
115 connInfo += filename;
121 dataset->moveBeforeFirst();
140 boost::gregorian::date d1(boost::gregorian::greg_year(2010),boost::gregorian::greg_month(1),15);
151 dsItem02->
setDateTime(3, static_cast<te::dt::DateTime*>(datetime1->
clone()));
159 dsItem03->
setDateTime(3, static_cast<te::dt::DateTime*>(datetime1->
clone()));
162 boost::gregorian::date d2(boost::gregorian::greg_year(2010),boost::gregorian::greg_month(2),15);
178 dsItem05->
setDateTime(3, static_cast<te::dt::DateTime*>(datetime2->
clone()));
186 dsItem06->
setDateTime(3, static_cast<te::dt::DateTime*>(datetime2->
clone()));
189 boost::gregorian::date d3(boost::gregorian::greg_year(2010),boost::gregorian::greg_month(3),15);
205 dsItem08->
setDateTime(3, static_cast<te::dt::DateTime*>(datetime3->
clone()));
213 dsItem09->
setDateTime(3, static_cast<te::dt::DateTime*>(datetime3->
clone()));
This file contains include headers for the Data Type module of TerraLib.
void setAutoNumber(bool a)
It tells if the property is an autonumber or not.
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
void setGeometry(std::size_t i, te::gm::Geometry *value)
It sets the value of the i-th property.
This file contains include headers for the memory data source of TerraLib.
void setSRID(int srid)
It sets the spatial reference system identifier associated to this property.
This file contains include headers for TerraLib Spatial Reference System module.
An atomic property like an integer or double.
te::da::DataSet * create_ds_memory(const std::string &datasetName, te::da::DataSetType *datasettype)
A class that models the description of a dataset.
This is a singleton for managing all data source instances available in the system.
static te::dt::Date ds(2010, 01, 01)
void openDirectory(const std::string &filename, const std::string dstype)
void setNumeric(std::size_t i, const std::string &value)
It sets the value of the i-th property.
void add(DataSetItem *item)
It adds a new item to the dataset and takes its ownership.
void openFile(const std::string &filename, const std::string dstype)
void setInt32(std::size_t i, boost::int32_t value)
It sets the value of the i-th property.
The type for arbitrary precison numbers, like numeric(p, q).
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
A point with x and y coordinate values.
A base class for date data types.
void setDateTime(std::size_t i, te::dt::DateTime *value)
It sets the value of the i-th property.
TEDATAACCESSEXPORT void Create(DataSource *ds, DataSetType *dt, DataSet *d, std::size_t limit=0)
It creates the dataset definition in a data source and then fill it with data from the input dataset...
Examples on how to access/manipulate DataSources in TerraLib.
static te::dt::TimeDuration dt(20, 30, 50, 11)
A factory for data sources.
void saveUsingOGR(const std::string &filename, const std::string drivername)
virtual AbstractData * clone() const =0
It returns a clone of this object.
void ExportingOGR()
An example using OGR data source driver to export some ;.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
A dataset is the unit of information manipulated by the data access module of TerraLib.
The type for date and time types: date, date period, date duration, time duration, time instant, time period, time instant with time zone or time period with time zone.
This file contains include headers for the TerraLib Common Runtime module.
This file contains include headers for the Vector Geometry model of TerraLib.
This file contains include headers for the Data Access module of TerraLib.