ArcGIS Server Banner

GP Service example: Drivetime polygons

GP Service example: Drivetime polygons

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback
Note: This topic was updated for 9.3.1.


Folder DriveTimePolygons
Purpose Creates drive–time polygons around input points for the given drive–time values.
Services SanFranciscoBaseMap (map service)

DriveTimePolygonsService (geoprocessing service)
Geoprocessing tasks Caclulate Drive Time Polygons
Inputs User digitizes a point and provides a space–separated list of drive–time values in minutes.
Outputs One drive–time polygon corresponding to each input drive–time value.
Data This example uses a street network dataset for San Francisco area provided in the ToolData folder.
Extensions Network Analyst.
Of note Demonstrates basic steps required to perform any network analysis workflow.

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, 1-, 2-, and 3- 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 of Find Drive Time Polygons

Data

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

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, DriveTime, which indicates the time taken to travel each street segment.

Basemap

The basemap for this example, 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

SanFranciscoBaseMap is published as a map service.

Toolbox and map document

The toolbox for the geoprocessing service is DriveTimePolygonsService.tbx, 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:

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 analyst 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 analyst layer Service Area layer.
Input Facilities Feature set (points), parameter Point features around which the drive–time polygons are determined.
Add Locations Tool Adds the input facility points to the Service Area layer.
Service Area (2) Network Analyst layer Service Area layer with facilities
Solve Tool Calculates the drive–time polygons.
Service Area (3) Network Analyst layer Service Area layer containing the calculated drive–time polygons.
Select Data Tool Selects the polygons sublayer from the service area layer.
Polygons Feature layer, output parameter The polygons layer from Service Area (3) network analyst layer.

Caclulate 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 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

Model Processes

The details about the model follow.

The Make Service Area Layer tool creates a new Network Analyst 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 Drive Time, which 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 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 the 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 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 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.

Learn more about the Select Data tool

Tool layer

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

The output of the Create Drive Time Polygons model is a feature layer. When a feature or raster layer is output by 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.

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 Service Area layers, output layers containing custom symbology. In order 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 Create 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 Polygon 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 ArcCatalog, right-click SanFranciscoBaseMap.mxd and click Publish to ArcGIS Server.
  2. Accept all defaults.
  3. In ArcCatalog, navigate to your server, right-click and choose Add New Service. Name the service DriveTimePolygonsService and choose Geoprocessing Service as the type.
  4. Click Next.
  5. In the next panel you choose Asynchronous for Execution type. For the tools exposed by the Geoprocessing service are stored in option, select A Map option and specify DriveTimePolygonsService.mxd for the Map Document. Since you will test your service, check Show Messages.
  6. Publishing the Find Drive Time Polygons Service

  7. 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. Optionally, change the background color for the data frame to light blue.
  3. Add the SanFranciscoBasemap map service to the ArcMap table of contents.
  4. Add the DriveTimePolygonsService geoprocessing service to ArcToolbox.
  5. Expand the DriveTimePolygonsService toolbox and open the Calculate Drive Time Polygons tool. The illustration below shows the result of these steps.
  6. Calculate Drivetime Polygons service in ArcMap session

  7. Add a point to create a facility location. Specify 3 4 5 for drive–time values and click OK to run the task.
  8. After the task completes, the table of contents should have the Drive Time Polygons output layer, as illustrated below.
  9. Completed task

  10. Take the opportunity to examine the result of the task in the Results tab of ArcToolbox, as illustrated below.
  11. results

See Also

  • Guide to the geoprocessing service examples