Loading geospatial data
IBM® Db2® Warehouse on Cloud and IBM Db2 Warehouse provide a set of advanced spatial data types that represent geometric concepts (such as points, lines, and polygons) and functions that interoperate with these data types. You can use these capabilities to integrate spatial information with your business data, adding another element of intelligence to your data analysis. For example, you can load geospatial data into a Db2 warehouse database and then analyze it to determine such things as the locations of office buildings or the size of a flood zone.
When loading geospatial data, Db2 Warehouse on Cloud and Db2 Warehouse:
- Analyzes the source file to identify the coordinate system that is defined for the source data.
- Finds a compatible spatial reference system (SRS) in the database. If no compatible SRS is available, one is automatically created based on the shape-file data.
- Inserts the data into a spatial column in a new table, or appends the data to an existing table. The table can also include a set of numeric or character columns with data that was contained in the shape file. You can use these additional columns when using SQL queries or R scripts to analyze the data.
The source file must be a compressed file in one of the following formats:
Each file must have the same base name (for example, geodata.shp,
geodata.dbf, geodata.shx, and
geodata.prj).
- tar.gz
- tar
- zip
Format | Extension | Contents | Required or Optional |
---|---|---|---|
Shape | .shp | The feature geometry | Required |
Attribute | .dbf | A columnar attribute for each shape | Required |
Index | .shx | A positional index of the feature geometry | Optional |
Projection | .prj | The coordinate system and projection information | Optional |
After you have created your files, you can load your geospatial data into your warehouse database by using the IDA LOADGEOSPATIALDATA command at the CLPPLUS command line.
Specifying the spatial reference system (SRS) during load:
- If you append data to an existing table, the SRS that is already associated with that table will be used.
- If you load data into a new table, you can select the SRS for the data from a list. If the SRS you need is not in the list, you can add a new one.