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:

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 minutes

Scenario

You are a data scientist working for a large insurance company, and you want to analyze occurrences of tornadoes in the conterminous United States. You want to determine which counties have the most tornadoes. You also want to correlate tornado occurrences with customer data to determine in which counties your company is exposed to the highest level of risk from potential tornado damage settlements.

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

  1. 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.
  2. Select Windows, then Catalog.
    Selecting Catalog from the Windows menu
  3. 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.
    Selecting Add Database Connection from the Database Connections node
  4. 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.
    Adding a database connection
  5. 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.
    Connecting to the Db2 database
  6. 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.
    Selecting a preloaded table

Preparing a base map

Procedure

  1. 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.
    Selecting Data View from the View menu
  2. 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.
    Clearing the check boxes of unneeded attributes
  3. 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.
    Selecting Properties from the Conterminous United States node
  4. 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.
    Selecting WGS 1984 from the Coordinate Systems tab in the Data Frame Properties window
  5. To resize the map, enter 1:25000000 in the field used to set the map scale.
    Setting the map scale to 1:25000000

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

  1. 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.
    Selecting the Catalog tab
  2. 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.
    The Calculate Extent window
  3. 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.
    The added query layer containing the counties
  4. 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.
    The added query layer containing the tornadoes
  5. Next, drag and drop the customer table above the tornado query layer. The locations of the customers are displayed as points.
    The added query layer containing the customer locations
  6. 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.
    Selecting the hand icon
  7. 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.
    Selecting an area of the map
  8. 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.
    Zooming into the selected area
  9. 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.
    Selecting Set Minimum Scale from the Visible Scale Range menu
  10. 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.
    Zooming out from the selected area

Tutorial summary

You can add a database connection in ArcMap by selecting a map and selecting DB2 as your database platform. To prepare a base map, set an appropriate map scale and display only necessary map details. Add data to a base map by dragging a database table from the database connections list and dropping it in the table of contents. This action creates a query layer. If you create multiple query layers, mind their order to avoid unintentionally obscuring information.