Tutorial 3: Using your own geospatial data
This is the last of a series of three tutorials that show you how to analyze geospatial data with Db2® and Esri ArcGIS:
- If you want to learn how to work with base maps first, view the first tutorial of this series: Tutorial 1: Working with base maps.
- Do you want to learn how to create your own maps? Then, view the second tutorial of this series: Tutorial 2: Creating new maps.
This tutorial shows you how to carry out the following tasks:
- Load your own geospatial data into Db2.
- Use uploaded data.
Time required
10 minutesScenario
Difficulty
Beginner
Audience
Data scientists
System requirements
- Windows 7 Ultimate, Professional and Enterprise (32 bit and 64 bit [EM64T])
- Windows 8 Pro and Enterprise (32 bit and 64 bit [EM64T])
- Windows 8.1 Pro and Enterprise (32 bit and 64 bit [EM64T])
Prerequisites
This scenario uses an Esri ArcGIS for Desktop installation that is connected to Db2 to visualize and analyze geospatial data (see Connecting Esri ArcGIS for Desktop). The data for this scenario is already loaded into your Db2 database. This scenario assumes that you already know how to work with base maps and how to create your own maps.
Preparing data for an individual geospatial load
Now, we'll show you how to load new geospatial data into your Db2 database, and how to put that data to use. But first, some background information: Geospatial data is typically made available in the form of shapefile sets. Many organizations such as the US Census Bureau and the US National Weather Service provide shapefile sets that can be downloaded from the internet.
For example, the US National Weather Service provides shapefile sets that contain data about current weather warnings. An insurance company could use this data to determine which customers are in danger and to warn them. This would give the customers time to secure their property and to prevent damage, which would benefit both the customers and the insurance company. You can download the files that contain geospatial data about current weather warnings from the National Weather Service Data Download in GIS Format page of the US National Weather Service website.
Procedure

Loading geospatial data into Db2 Warehouse SaaS
Procedure
- Use the IDA LOADGEOSPATIALDATA command to load the downloaded shapefiles into your Db2 database.
- After loading the data, return to ArcMap.
Using uploaded data
Procedure
SELECT W.*, (
SELECT SUM(C.INSURANCE_VALUE)
FROM SAMPLES.GEO_CUSTOMER AS C
WHERE DB2GSE.ST_INTERSECTS(W.GEO_DATA,C.SHAPE) = 1 SELECTIVITY 0.00001
) AS COUNTY_INSURANCE_VALUE
FROM GEO_WEATHER_WARNINGS AS W

SELECT * FROM SAMPLES.GEO_CUSTOMER WHERE OBJECTID IN (
SELECT DISTINCT C.OBJECTID
FROM SAMPLES.GEO_CUSTOMER AS C,
GEO_WEATHER_WARNINGS AS W
WHERE DB2GSE.ST_INTERSECTS(W.GEO_DATA,C.SHAPE) = 1 SELECTIVITY 0.00001
)








