Tutorial 1: Working with base maps
This is the first of a series of three tutorials that show you how to analyze geospatial data with Db2® and Esri ArcGIS:
- Do you already know how to work with base maps and want to create your own maps? Then, view the second tutorial of this series: Tutorial 2: Creating new maps.
- The third tutorial of this series, Tutorial 3: Using your own geospatial data, shows you how to upload and use your own geospatial data.
This tutorial shows you how to carry out the following tasks:
- Add a database connection in ArcMap.
- Prepare a base map.
- Add data to a base map.
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.
Adding a database connection in ArcMap
Procedure
- Now, launch the Esri ArcMap software. When you launch Esri ArcMap for the first time, the window for creating a new map opens automatically. If it's not the first time, click File and then New to open this window. Esri provides various base maps. For this example, select the map showing the conterminous United States.
- Select Windows, then Catalog.
- In the Catalog window, click the plus symbol to open the Database Connections node. To add a new database connection, double-click Add Database Connection.
- Select DB2 as your database platform. In the data source field, paste the string you copied from the Knowledge Center and update the host name, port, and database name with the values you noted earlier. For the authentication type, select Database authentication. Enter your user name and password, and click OK.
- The new database connection is displayed below the Add Database Connection icon. Right-click this database and select Connect to connect ArcCatalog to the Db2 database.
- Each Db2 instance is preloaded with three tables that contain data about counties, customers, and tornadoes. Later, we'll show you how you can load your own spatial data, but for now, we will only use these preloaded tables.
Preparing a base map
Procedure
- Before we continue, we need to set the data view of the map. The default view of a base map is the layout view. However, for this scenario the data view is more suitable. To select the data view, click View, then Data View.
- For this scenario, there is no need to show details such as highways and rivers, so remove all unneeded attributes by clearing the corresponding check boxes.
-
The data contained in the sample tables uses the WGS 1984 coordinate
system. To set the coordinate system, in the table of contents, right-click
Conterminous United States
and select Properties from the pop-up menu. - Scroll the window until you see Geographic Coordinate Systems. Click the plus-symbol to open the node and scroll down to the World folder. Click the plus-symbol there, scroll down and select WGS 1984. Click OK to confirm.
- To resize the map, enter 1:25000000 in the field used to set the map scale.
Adding data to the base map
Now that ArcMap is connected to Db2 and the base map has been prepared, we are ready to begin our scenario. This scenario demonstrates how you can combine the data in the preloaded tables in ways that generate new information that might be of interest to an insurance company. Before we continue, let's have a closer look at the sample tables: The county table contains data needed to map out all US counties. The tornado table contains historical tornado data covering all tornadoes in the US from 1950 through 2013. The customer table contains information about an artificial set of insurance customers, including the location and value of their insured property.
Procedure
- Begin by adding the data tables to your customized map. Return to the catalog window by selecting the catalog tab on the right side of the window.
- Drag the county table, that's BLUDB.SAMPLES.GEO_COUNTY, from the database connections list and drop it in the table of contents, above the entry for the base map. The Calculate Extentwindow is displayed. In this window, click Use Spatial Reference Extent. This causes the base map to be updated faster than it would if you selected Input Extent.
- Notice that a new entry is added to the table of contents, and that its check box is selected. The new entry is called a "query layer", which is an ArcGIS construct that corresponds to an SQL query. This new query layer specifies an SQL query that selects the contents of the table. When a query layer is selected in the table of contents, its contents are reflected in the map, which is why the map now shows the USA subdivided into its counties.
- Now, we will repeat this procedure for the two remaining tables: Drag and drop the tornado table to the table of contents and drop it above the query layer for the counties. ArcGIS automatically creates a new query layer for the tornado table, and each tornado is now represented on the map as a line that shows its path. Because the tornado query layer is above the counties query layer in the table of contents, the tornado paths are overlaid on top of the counties. If the order were reversed, the shading of the counties would obscure the information about the tornadoes, so the order in which query layers are listed in the table of contents is important.
- Next, drag and drop the customer table above the tornado query layer. The locations of the customers are displayed as points.
- You can zoom in to get a more detailed view of the map. To do this, select the hand icon, which represents the pan function.
- Now, when you hover the pointer over the map, you can see that it changes into the shape of a hand. To zoom in, press and hold Shift and left-click while dragging the mouse. This way, you can create a rectangular frame to select an area of the map. When you let go the left mouse key, the map zooms in to show the selected area. You can repeat this procedure as often as needed to zoom in on a smaller and smaller area of the map.
- When you let go the left mouse key, the map zooms in to show the selected area. You can repeat this procedure as often as needed to zoom in on an ever smaller area of the map.
- Because the customer data can take a long time to load, and because a large number of customer data points clutters a map that shows a large area, it is a good idea to set a lower limit for the visible scale range. This will prevent the layer from being redrawn when you zoom out of the current scale of the map. To do this, right-click on the customer-layer, select Visible Scale Range, then select Set Minimum Scale. This sets the minimum scale for the customer query layer to the current map scale, which is 1:183,605.
- To review the minimum scale setting, zoom out the map. You can do this by scrolling the mouse wheel forward or by entering a larger scale in the scale field. Note that when you zoom out beyond the specified minimum scale, the customer points are no longer displayed.