Make Service Area Layer (Network Analyst)
Summary
Makes a service area network analysis layer and sets its analysis properties. A service area analysis layer is useful in determining the area of accessibility within a given cutoff cost from a facility location.
Usage
After creating the analysis layer with this tool, you can add network analysis objects to it using the Add Locations tool, solve the analysis using the Solve tool, and save the results on disk using Save To Layer File tool.
-
When using this tool in geoprocessing models, if the model is run as a tool, the output network analysis layer must be made a model parameter. Otherwise the output layer is not added to the table of contents in ArcMap.
Syntax
Parameter | Explanation | Data Type |
in_network_dataset |
The network dataset on which the service area analysis will be performed. | Network Dataset Layer |
out_network_analysis_layer |
Name of the service area network analysis layer to create. | String |
impedance_attribute |
The cost attribute to be used as impedance in the analysis. | String |
travel_from_to (Optional) |
Specifies the direction of travel to or from the facilities.
Using this option can result in different service areas on a network with one-way restrictions and having different impedances based on direction of travel. The service area for a pizza delivery store, for example, should be created away from the facility, whereas the service area of a hospital should be created toward the facility. | String |
default_break_values (Optional) |
Default impedance values indicating the extent of the service area to be calculated. The default can be overridden by specifying the breaks value on the facilities. Multiple polygon breaks can be set to create concentric service areas. For instance, to find 2-, 3-, and 5-minute service areas for the same facility, specify "2 3 5" as the value for the Default break values parameter (the numbers 2, 3, and 5 should be separated by a space). | String |
polygon_type (Optional) |
Specifies the type of polygons to be generated.
If your data is of an urban area with a gridlike network, the difference between generalized and detailed polygons would be minimal. However, for mountain and rural roads, the detailed polygons may present significantly more accurate results than generalized polygons. | String |
merge (Optional) |
Specifies the options to merge polygons that share similar break values. This option is applicable only when generating polygons for multiple facilities.
| String |
nesting_type (Optional) |
Specifies the option to create concentric service area polygons as disks or rings. This option is applicable only when multiple break values are specified for the facilities.
| String |
line_type (Optional) |
Specifies the type of lines to be generated based on the service area analysis. Selecting the TRUE_LINES or TRUE_LINES_WITH_MEASURES option for large service areas will increase the amount of memory consumed by the analysis.
| String |
overlap (Optional) |
Determines if overlapping lines are generated when the service area lines are computed.
| Boolean |
split (Optional) |
| Boolean |
excluded_source_name [excluded_source_name,...] (Optional) |
Specifies the list of network sources to be excluded when generating the polygons. The geometry of traversed elements from the excluded sources will be omitted from all polygons. This is useful if you have some network sources that you don't want to be included in the polygon generation because they create less accurate polygons or are inconsequential for the service area analysis. For example, while creating a drive time service area in a multimodal network of streets and rails, you should choose to exclude the rail lines from polygon generation so as to correctly model where a vehicle could travel. Excluding a network source from service area polygons does not prevent those sources from being traversed. Excluding sources from service area polygons only influences the polygon shape of the service areas. If you want to prevent traversal of a given network source, you must create an appropriate restriction when defining your network dataset. | String |
accumulate_attribute_name [accumulate_attribute_name,...] (Optional) |
List of cost attributes to be accumulated during analysis. These accumulation attributes are purely for reference; the solver only uses the cost attribute specified by the Impedance attribute parameter to calculate the route. For each cost attribute that is accumulated, a Total_[Impedance] property is added to the routes that are output by the solver. | String |
UTurn_policy (Optional) |
Restrict or permit U-turns at junctions that could occur during network traversal between stops.
| String |
restriction_attribute_name [restriction_attribute_name,...] (Optional) |
List of restriction attributes to apply during the analysis. | String |
polygon_trim (Optional) |
| Boolean |
poly_trim_value (Optional) |
Specifies the distance within which the service area polygons are trimmed. The parameter includes a value and units for the distance. The default value is 100 meters. | Linear unit |
lines_source_fields (Optional) |
| Boolean |
Code Sample
Execute the tool using only the required parameters
import arcpy arcpy.env.workspace = "C:/ArcTutor/Network Analyst/Tutorial/SanFrancisco.gdb" arcpy.MakeServiceAreaLayer_na("Transportation/Streets_ND","FireStationCoverage", "Minutes")
Execute the tool using all parameters
import arcpy arcpy.env.workspace = "C:/ArcTutor/Network Analyst/Tutorial/Paris.gdb" arcpy.MakeServiceAreaLayer_na("Transportation/ParisNet","WarehouseCoverage", "Drivetime","TRAVEL_FROM","5 10 15", "SIMPLE_POLYS", "NO_OVERLAP","RINGS","TRUE_LINES", "NON_OVERLAP","NO_SPLIT", ["Metro_Lines","Transfer_Stations", "Transfer_Street_Station"], ["Meters","Drivetime"],"ALLOW_DEAD_ENDS_ONLY", ["Oneway"],"NO_TRIM_POLYS","", "LINES_SOURCE_FIELDS")
The following stand-alone Python script demonstrates how the MakeServiceAreaLayer tool can be used to generate 1-,2-,3- minute service area around fire stations.
# Name: MakeServiceAreaLayer_Workflow.py # Description: Generate 1-,2-,3- minute service area around fire stations and # save the results to a layer file on disk. The service area # polygons can be used to visualize the areas that do not have # adequate coverage from the fire stations # Requirements: Network Analyst Extension # Author: ESRI #Import system modules import arcpy from arcpy import env try: #Check out the Network Analyst extension license arcpy.CheckOutExtension("Network") #Set environment settings env.workspace = "C:/data/SanFrancisco.gdb" env.overwriteOutput = True #Set local variables inNetworkDataset = "Transportation/Streets_ND" outNALayer = "FireStationCoverage" impedanceAttribute = "TravelTime" inFacilities = "Analysis/FireStations" outLayerFile = "C:/data/output" + "/" + outNALayer + ".lyr" #Create a new service area layer. We wish to generate the service area #polygons as rings, so that we can easily visualize the coverage for any #given location. We also want overlapping polygons as we can determine the #number of fire stations that cover a given location. We will specify these #options while creating the new service area layer. arcpy.MakeServiceAreaLayer_na(inNetworkDataset, outNALayer, impedanceAttribute, "TRAVEL_FROM", "1 2 3", "SIMPLE_POLYS", "NO_MERGE", "RINGS") #Load the fire stations as facilities using deafult field mappings and #default search tolerance arcpy.AddLocations_na(outNALayer, "Facilities", inFacilities, "","") #Solve the service area layer arcpy.Solve_na(outNALayer) #Save the solved service area layer as a layer file on disk with relative #paths arcpy.SaveToLayerFile_management(outNALayer,outLayerFile,"RELATIVE") print "Script completed successfully" except Exception as e: # If an error occurred, print line number and error message import traceback, sys tb = sys.exc_info()[2] print "An error occured on line %i" % tb.tb_lineno print str(e)