-
Notifications
You must be signed in to change notification settings - Fork 0
Module 2B, Storing different data sources
learning objective: How to configure writing data to data storage in a GeoDMS project
With the GeoDMS, you can also store/export data using different storage types.
We are working on implementing GDAL also to store/export data, resulting in the ability to export to many (GIS) formats. Momentarily, data can be exported to ESRI Shapefile, GeoPackage, ASCII Files (like .csv and .xml) and GeoTiff.
This module focuses on writing to shape files. For information on exporting/storing data in these formats, see the described formats.
In the example below, we will use the configuration for the Corop data from module 2A. To read the data from an ESRI Shapefile, the configurations looks as follows:
unit<uint32> Corop : StorageName = "%ProjDir%/Data/CBS_COROP_2012.shp" , StorageType = "gdal.vect" , StorageReadOnly = "True" { attribute<Geography/rdc> geometry (polygon); }
The configured geometry feature attribute loads a polygon geometry for each Corop entry.
Assume we now want to export this data in new shape files. The configuration for writing the new shape file with the polygon geometry and the corop label is presented here:
unit<uint32> CoropExport := Corop, StorageName = "%LocalDataProjDir%/CBS_COROP_2012.dbf"` { attribute<Geography/rdc> geometry (polygon) := Corop/geometry , StorageName = "%LocalDataProjDir%/CBS_COROP_2012.shp"; attribute<string> label := Corop/statnaam; }
A new domain unit: CoropExport is configured with as expression a direct reference to the domain unit used to read the data (Corop).
In the example, the data is assumed to be configured in the same context. If the Corop unit was, for example, configured in a SourceData container, the reference would be SourceData/Corop.
The ESRI Shapefile model consists of a set of physical files, of which the .shp, .shx and .dbf are essential. With the GeoDMS, the .shp (and .shx index file) is written separately from the .dbf file, as they use a different StorageManager.
In the example, you see that the resulting .dbf file is configured for the CoropExport unit. All configured subitems, without the geometry, are stored in the .dbf file (in the example only label).
Results written with the GeoDMS are often written to the LocalDataDir, therefore the placeholder: LocalDataProjDir is used in the StorageName for exporting the data.
The geometry attribute needs to be stored in the .shp file. Therefore, the StorageName property for this attribute is configured to almost the same first part of the file name, only now with the extension: .shp.
An index file (.shx) is also stored if the .shp is written.
Use the same example configuration of module 2A (it can be downloaded here); you will need from the data subfolder (..\GeoDMS_Academy\data_sources\data) only the ESRI shape file : NS_Stations_2019_RD (points).
Configure reading (already done in module 2A) and write the shape file in the configuration file: exercise.dms (in the cfg subfolder of your downloaded project) and use the GeoDMS GUI to export the data.
tip: use the %ProjDir% placeholder in the StorageName property to refer to the files in the data subfolder.
First, try to figure it out yourself. The configuration with the results is also available in the downloaded project. Just open the result.dms file with the GeoDMS GUI in the cfg subfolder of your downloaded project. See the container Export.
Go to previous module: Module 2A, Loading different data sources
Go to next module: Module 2C, GeoDMS own data formats
GeoDMS Academy
- 0: Install GeoDMS GUI and setup a configuration
- 1: Learning the basic concepts of GeoDMS
- 2: Loading and storing data sources
- 3: Basic analyses with vector data (WORK IN PROGRESS)
- 4: Basic analyses with grid data (WORK IN PROGRESS)
- 5a: Working with networks over a road network
- 5b: Working with networks in a public transport setting
- 6: Allocating land-use