GP service example: Drive-time polygons

Complexity: Intermediate Data Requirement: ArcGIS Tutorial Data Setup Data Path: C:\ArcGIS\ArcTutor\GP Service Examples\DriveTimePolygons Goal: Author, publish, and use a geoprocessing service that creates polygons based on drive time around points.

Folder

DriveTimePolygons

Purpose

Creates drive-time polygons around input points for the given drive-time values

Services

  • SanFranciscoBaseMap (map service)
  • DriveTimePolygonsService (geoprocessing service)

Geoprocessing task

Calculate Drive Time Polygons

Inputs

A digitized point and a space-separated list of drive-time values in minutes.

Outputs

One drive-time polygon corresponding to each input drive-time value for all points.

Data

Uses a street network dataset for the San Francisco area provided in the ToolData folder.

Extensions

Network Analyst

Of note

Demonstrates basic steps required to perform any network analysis workflow.

About this example

Corresponding folder

C:\arcgis\ArcTutor\GP Service Examples\DriveTimePolygons contains the completed model and data.

About the Calculate Drive Time Polygons task

The primary purpose of the Calculate Drive Time Polygons task is to create drive-time polygons around user-specified points. A drive-time polygon is a region that encompasses all accessible streets that lie within a specified drive time from that point. Drive-time polygons can be used to evaluate accessibility of a point with respect to some other features. For example, one-, two-, and three-minute drive-time polygons around a grocery store location can be used to determine which people are most likely to shop at the store.

Example output from Calculate Drive Time Polygons task
Example output from Calculate Drive Time Polygons task

Data

The data for this example comes from C:\arcgis\ArcTutor\GP Service Examples\DriveTimePolygons.

DriveTimePolygons folder contents
DriveTimePolygons folder contents

Network dataset

The ToolData folder contains a file geodatabase, SanFrancisco.gdb. This geodatabase contains a network dataset, Streets_ND, within the Transportation feature dataset. This network dataset models the street network for the San Francisco area. It provides a network attribute, TravelTime (among others), which indicates the time taken to travel each street segment in minutes.

Basemap

The basemap layer within SanFranciscoBasemap.mxd has a layer, Streets, as illustrated below. This layer shows the extent of the network dataset. This means that this task can be used to determine drive-time polygons only in this extent.

San Francisco basemap showing the network dataset extent
San Francisco basemap showing the network dataset extent

SanFranciscoBaseMap.mxd is published as a map service.

Toolbox and map document

The toolbox for the geoprocessing service is DriveTimePolygonsService, and the source map document for the service is DriveTimePolygonsService.mxd. DriveTimePolygonsService.mxd contains one source data layer, Streets_ND (the network dataset).

Model

Model overview

The Calculate Drive Time Polygons model is illustrated below. There are two input variables:

  • Input Facilities are the centers of the drive-time polygons to be generated. (In network analysis, a facility is any fixed location on the network, such as a building or your current location.)
  • Drive Time Values is a space-separated list of drive-time values in minutes.

The model creates a service area network analysis layer, adds the user-digitized points as facilities, and performs a solve to determine the drive-time polygons.

Element

Type

Description

Streets_ND

Network dataset layer

The network dataset layer.

Drive Time Values

String, input parameter

Space-separated list of drive-time values in minutes.

Make Service Area Layer

Tool

Creates a service area network analysis layer. This layer contains both data and properties that determine how service areas will be calculated, along with the results of the calculation.

Service Area

Network analysis layer

Service area layer.

Input Facilities

Feature set (points), input parameter

Point features around which the drive-time polygons are determined.

Add Locations

Tool

Adds the input points as facilities to the service area layer.

Service Area (2)

Network analysis layer

Service area layer with facilities.

Solve

Tool

Calculates the drive-time polygons.

Service Area (3)

Network analysis layer

Service area layer containing the calculated drive-time polygons.

SolveSucceeded

Boolean

The derived output from the Solve tool that indicates if the solve was successful.

Select Data

Tool

Selects the polygons sublayer from the service area layer.

Polygons

Feature layer, output parameter

The polygons layer from the Service Area (3) network analysis layer.

Model elements
Calculate Drive Time Polygons model

Network analysis workflow

This model illustrates the four-step workflow that is common while performing any kind of network analyses.

  1. Make a network analysis layer.
  2. Add locations to one or more network analysis classes.
  3. Solve the network analysis layer.
  4. Use the results after the solve.

Using the network layer

The network dataset for the San Francisco area is added to the map document DriveTimePolygonsService.mxd as a network layer (Streets_ND). This layer is used in the model as an input variable for the Make Service Area Layer tool. Using a network layer greatly improves the overall model execution time since a connection to the network dataset is kept open by the network layer. Otherwise, if the network dataset is referenced from its disk location, a connection to the network dataset is made each time the model executes, which reduces the performance of the geoprocessing service created using the model.

Using a network dataset layer
Using a network dataset layer

Model processes

The Make Service Area Layer tool creates a new Network Analyst (NA) layer, ServiceArea, that stores the analysis properties, references the Streets_ND network dataset layer used for the analysis, and stores the input facilities and the output polygons. The network dataset has a network cost attribute called TravelTime that specifies the travel time required to traverse each street segment. This attribute is used as an impedance attribute. The default break values are read from the Drive Time Values variable as a space-separated list of values.

Make Service Area Layer tool parameters
Make Service Area Layer tool parameters

For this service, the NO_MERGE option was used to create overlapping polygons that do not merge for each facility. The RINGS option is used so that for each drive-time value, the polygons are drawn as rings. This results in polygons that encompass the area from the previous break up to the cutoff value for the break and do not include the area of the smaller breaks.

The Add Locations tool adds the user-digitized points as facilities to the service area layer. The Input Facilities parameter is a feature set data type so that the model can interactively accept the user-digitized points as facilities. The schema and symbology for the feature set are derived from the InputFacilities.lyr file found within the ToolData folder.

Using a feature set for input facilities
Using a feature set for input facilities

The Solve tool calculates the service area based on the options specified in the input service area layer and generates the drive-time polygons. The calculated polygons are written to the Polygons sublayer in the output service area layer.

Network Analyst layers are not supported output parameter data types for ArcGIS Server clients. So the Select Data tool is used to retrieve the Polygons sublayer from the service area layer. The Polygons sublayer is a feature layer data type.

Tool layer

The Calculate Drive Time Polygons tool layer is created by dragging the model into the ArcMap table of contents. You should test the model before publishing as follows:

  1. Create the tool layer.
  2. Right-click the tool layer and click Open. The tool dialog box opens.
  3. Enter a point and drive-time distances, such as 1 2 3, and click OK.

    The drive-time polygons are added as a sublayer to the tool layer.

The output of the Calculate Drive Time Polygons model is a feature layer. When a feature or raster layer is output by a model, the output layer is added to the tool layer as is, meaning symbology you define in the tool sublayer is ignored. You can try the following experiment to confirm this:

  1. After opening and executing the tool layer, right-click the Polygons sublayer and click Properties.
  2. Click the Symbology tab.
  3. Change the symbology to a single symbol (a blue polygon fill, for example).

    The Polygons sublayer is now drawn with a single color instead of graduated colors.

  4. Open the tool layer and execute.

    The Polygons sublayer is again drawn with graduated colors.

As explained in the topic Defining output symbology for geoprocessing tasks, when a model outputs a layer, the symbology found in the layer takes precedence over tool layer symbology. The reason for this rule is that some tools, like Make Service Area Layer, output layers containing custom symbology. To preserve this custom symbology, the symbology in the tool sublayer is ignored. If you want to change symbology of the drive-time polygons, the Calculate Drive Time Polygons model will need to output a feature class instead of a feature layer. This is easily accomplished by adding the Copy Features tool to the model, using the Polygons variable as input to Copy Features.

Publishing

SanFranciscoBaseMap.mxd is published as a map service. DriveTimePolygonsService.mxd is published as a geoprocessing service with no result map service, as follows:

  1. In the Catalog window, right-click SanFranciscoBaseMap.mxd and click Publish to ArcGIS Server.
  2. Accept all defaults.
  3. In the Catalog window, navigate to your server administrative connection under the GIS Servers node, right-click, then choose Add New Service. Name the service DriveTimePolygonsService and choose Geoprocessing Service as the type.
  4. Click Next.
  5. In the next panel, choose Asynchronous for Execution Type. For The tools exposed by the Geoprocessing Service are stored in option, choose A map and specify DriveTimePolygonsService.mxd for Map Document. Since you will test your service, check Show Messages.
    Publishing the DriveTimePolygonsService
    Publishing DriveTimePolygonsService
  6. Click Next. From this point on, you can accept the default values provided by the wizard and create the service.

Using

  1. Start ArcMap with a blank document.
  2. Create a user connection to ArcGIS Server from the Catalog window if one does not exist.
  3. Add the SanFranciscoBaseMap map service to the ArcMap table of contents.
  4. In the Catalog window, under your GIS Servers user connection node, expand the DriveTimePolygonsService toolbox and open the Calculate Drive Time Polygons tool by double-clicking it. The illustration below shows the result of these steps:
    Calculate Drive Time Polygons task in an ArcMap session
  5. Add a point to create a facility location. Specify 2 3 4 for drive-time values and click OK to run the task.

    After the task completes, the table of contents contains the Polygons output layer, as illustrated below.

    Completed task
    Completed task
  6. Take the opportunity to examine the result of the task in the Results window as illustrated below.
    Task results
    Task results

Related Topics


11/18/2013