arcgis.network module

The arcgis.network module contains classes and functions for network analysis. Network layers and analysis can be used for operations such as finding the closest facility, the best route for a vehicle, the best routes for a fleet of vehicles, locating facilities using location allocation, calculating an OD cost matrix, and generating service areas.

NetworkLayer

class arcgis.network.NetworkLayer(url, gis=None)

NetworkLayer represents a single network layer. It provides basic information about the network layer such as its name, type, and network classes. Additionally, depending on the layer type, it provides different pieces of information.

It is a base class for RouteLayer, ServiceAreaLayer, and ClosestFacilityLayer.

retrieve_travel_modes()

identify all the valid travel modes that have been defined on the network dataset or in the portal if the GIS server is federated

RouteLayer

class arcgis.network.RouteLayer(url, gis=None)

The Route Layer which has common properties of Network Layer as well as some attributes unique to Route Network Layer only.

solve(stops, barriers=None, polyline_barriers=None, polygon_barriers=None, travel_mode=None, attribute_parameter_values=None, return_directions=True, return_routes=True, return_stops=False, return_barriers=False, return_polyline_barriers=True, return_polygon_barriers=True, out_sr=None, ignore_invalid_locations=True, output_lines=None, find_best_sequence=False, preserve_first_stop=True, preserve_last_stop=True, use_time_windows=False, start_time=None, start_time_is_utc=False, accumulate_attribute_names=None, impedance_attribute_name=None, restriction_attribute_names=None, restrict_u_turns=None, use_hierarchy=True, directions_language=None, directions_output_type=None, directions_style_name=None, directions_length_units=None, directions_time_attribute_name=None, output_geometry_precision=None, output_geometry_precision_units=None, return_z=False, overrides=None, preserve_objectid=False, future=False, time_windows_are_utc=False, return_traversed_edges=None, return_traversed_junctions=None, return_traversed_turns=None, geometry_precision=None, geometry_precision_z=None, geometry_precision_m=None)

The solve operation is performed on a network layer resource. The solve operation is supported on a network layer whose layerType is esriNAServerRouteLayer. You can provide arguments to the solve route operation as query parameters.

Parameter

Description

stops

Required Points/FeatureSet/a list of Features. The set of stops loaded as network locations during analysis. Stops can be specified using a simple comma / semi-colon based syntax or as a JSON structure. If stops are not specified, preloaded stops from the map document are used in the analysis.

barriers

Optional Point/FeatureSet. The set of barriers loaded as network locations during analysis. Barriers can be specified using a simple comma/semi-colon based syntax or as a JSON structure. If barriers are not specified, preloaded barriers from the map document are used in the analysis. If an empty json object is passed (‘{}’) preloaded barriers are ignored.

polyline_barriers

Optional Polyline/FeatureSet. The set of polyline barriers loaded as network locations during analysis. If polyline barriers are not specified, preloaded polyline barriers from the map document are used in the analysis. If an empty json object is passed (‘{}’) preloaded polyline barriers are ignored.

polygon_barriers

Optional Polygon/FeatureSet. The set of polygon barriers loaded as network locations during analysis. If polygon barriers are not specified, preloaded polygon barriers from the map document are used in the analysis. If an empty json object is passed (‘{}’) preloaded polygon barriers are ignored.

travel_mode

Optional string. Travel modes provide override values that help you quickly and consistently model a vehicle or mode of transportation. The chosen travel mode must be preconfigured on the network dataset that the routing service references.

attribute_parameter_values

Optional string/list. A set of attribute parameter values that can be parameterized to determine which network elements can be used by a vehicle.

return_directions

Optional boolean. If true, directions will be generated and returned with the analysis results. Default is true.

return_routes

Optional boolean. If true, routes will be returned with the analysis results. Default is true.

return_stops

Optional boolean. If true, stops will be returned with the analysis results. Default is false.

return_barriers

Optional boolean. If true, barriers will be returned with the analysis results. Default is false.

return_polyline_barriers

Optional boolean. If true, polyline barriers will be returned with the analysis results. Default is false.

return_polygon_barriers

Optional boolean. If true, polygon barriers will be returned with the analysis results. Default is false.

out_sr

Optional Integer. The spatial reference of the geometries returned with the analysis results.

ignore_invalid_locations

Optional boolean. - If true, the solver will ignore invalid locations. Otherwise, it will raise an error. Default is true.

output_lines

The type of output lines to be generated in the result. The default is as defined in the network layer. Values: esriNAOutputLineTrueShape |

esriNAOutputLineTrueShapeWithMeasure | esriNAOutputLineStraight | esriNAOutputLineNone

find_best_sequence

Optional boolean. If true, the solver should re-sequence the route in the optimal order. The default is as defined in the network layer.

preserve_first_stop

Optional boolean. If true, the solver should keep the first stop fixed in the sequence. The default is as defined in the network layer.

preserve_last_stop

Optional boolean. If true, the solver should keep the last stop fixed in the sequence. The default is as defined in the network layer.

use_time_window

Optional boolean. If true, the solver should consider time windows. The default is as defined in the network layer.

start_time

Optional string. The time the route begins. If not specified, the solver will use the default as defined in the network layer.

start_time_is_utc

Optional boolean. The time zone of the startTime parameter.

accumulate_attribute_names

Optional string. A list of network attribute names to be accumulated with the analysis. The default is as defined in the network layer. The value should be specified as a comma separated list of attribute names. You can also specify a value of none to indicate that no network attributes should be accumulated.

impedance_attribute_name

Optional string. The network attribute name to be used as the impedance attribute in analysis. The default is as defined in the network layer.

restriction_attribute_names

Optional string. -The list of network attribute names to be used as restrictions with the analysis. The default is as defined in the network layer. The value should be specified as a comma separated list of attribute names. You can also specify a value of none to indicate that no network attributes should be used as restrictions.

restrict_u_turns

Optional boolean. Specifies how U-Turns should be restricted in the analysis. The default is as defined in the network layer. Values: esriNFSBAllowBacktrack | esriNFSBAtDeadEndsOnly |

esriNFSBNoBacktrack | esriNFSBAtDeadEndsAndIntersections

use_hierarchy

Optional boolean. If true, the hierarchy attribute for the network should be used in analysis. The default is as defined in the network layer.

directions_language

Optional string. The language to be used when computing directions. The default is the language of the server’s operating system. The list of supported languages can be found in REST layer description.

directions_output_type

Optional string. Defines content, verbosity of returned directions. The default is esriDOTInstructionsOnly. Values: esriDOTComplete | esriDOTCompleteNoEvents

esriDOTInstructionsOnly | esriDOTStandard |

esriDOTSummaryOnly

directions_style_name

Optional string. The style to be used when returning the directions. The default is as defined in the network layer. The list of supported styles can be found in REST layer description.

directions_length_units

Optional string. The length units to use when computing directions. The default is as defined in the network layer. Values: esriNAUFeet | esriNAUKilometers | esriNAUMeters |

esriNAUMiles | esriNAUNauticalMiles | esriNAUYards | esriNAUUnknown

directions_time_attribute_name

Optional string. The name of network attribute to use for the drive time when computing directions. The default is as defined in the network layer.

output_geometry_precision

Optional float. The precision of the output geometry after generalization. If 0, no generalization of output geometry is performed. The default is as defined in the network service configuration.

output_geometry_precision_units

Optional string. The units of the output geometry precision. The default value is esriUnknownUnits. Values: esriUnknownUnits | esriCentimeters | esriDecimalDegrees |

esriDecimeters | esriFeet | esriInches | esriKilometers | esriMeters | esriMiles | esriMillimeters | esriNauticalMiles | esriPoints | esriYards

return_z

Optional boolean. If true, Z values will be included in the returned routes and compressed geometry if the network dataset is Z-aware. The default is false.

overrides

Optional dictionary. Specify additional settings that can influence the behavior of the solver. A list of supported override settings for each solver and their acceptable values can be obtained by contacting Esri Technical Support.

preserve_objectid

Optional Boolean. If True, all objectid values are maintained. The default is False.

future

Optional boolean. If True, a future object will be returned and the process will not wait for the task to complete. The default is False, which means wait for results.

time_windows_are_utc

Optional boolean. Specify whether the TimeWindowStart and TimeWindowEnd attribute values on stops are specified in coordinated universal time (UTC) or geographically local time.

return_traversed_edges

Optional boolean. Specify whether traversed edges will be returned by the service.

return_traversed_junctions

Optional boolean. Specify whether traversed junctions will be returned by the service.

return_traversed_turns

Optional boolean. Specify whether traversed turns will be returned by the service.

geometry_precision

Optional Integer. Use this parameter to specify the number of decimal places in the response geometries returned by solve operation. This applies to x/y values only (not m- or z-values).

geometry_precision_z

Optional Integer. Use this parameter specify the number of decimal places in the response geometries returned by solve operation. This applies to z-value only.

geometry_precision_m

Optional Integer. Use this parameter to specify the number of decimal places in the response geometries returned by solve operation. This applies to m-value only.

Returns

dict

# USAGE EXAMPLE: Solving the routing problem by passing in a FeatureSet

# get a FeatureSet through query
fl = sample_cities.layers[0]
cities_to_visit = fl.query(where="ST = 'CA' AND POP2010 > 300000",
                           out_fields='NAME', out_sr=4326)

type(cities_to_visit)
>> arcgis.features.feature.FeatureSet

# pass in the FeatureSet
result = route_layer.solve(stops=cities_to_visit, preserve_first_stop=True,
                           preserve_last_stop=True, find_best_sequence=True, return_directions=False,
                           return_stops=True, return_barriers=False, return_polygon_barriers=False,
                           return_polyline_barriers=False, return_routes=True,
                           output_lines='esriNAOutputLineStraight')

ServiceAreaLayer

class arcgis.network.ServiceAreaLayer(url, gis=None)

The Service Area Layer which has common properties of Network Layer as well as some attributes unique to Service Area Layer only.

solve_service_area(facilities, barriers=None, polyline_barriers=None, polygon_barriers=None, travel_mode=None, attribute_parameter_values=None, default_breaks=None, exclude_sources_from_polygons=None, merge_similar_polygon_ranges=None, output_lines=None, output_polygons=None, overlap_lines=None, overlap_polygons=None, split_lines_at_breaks=None, split_polygons_at_breaks=None, trim_outer_polygon=None, trim_polygon_distance=None, trim_polygon_distance_units=None, return_facilities=False, return_barriers=False, return_polyline_barriers=False, return_polygon_barriers=False, out_sr=None, accumulate_attribute_names=None, impedance_attribute_name=None, restriction_attribute_names=None, restrict_u_turns=None, output_geometry_precision=None, output_geometry_precision_units='esriUnknownUnits', use_hierarchy=None, time_of_day=None, time_of_day_is_utc=None, travel_direction=None, return_z=False, overrides=None, preserve_objectid=False, future=False, ignore_invalid_locations=True, geometry_precision=None, geometry_precision_z=None, geometry_precision_m=None)

The solve service area operation is performed on a network layer resource of type service area (layerType is esriNAServerServiceArea). You can provide arguments to the solve service area operation as query parameters.

Parameter

Description

facilities

The set of facilities loaded as network locations during analysis. Facilities can be specified using a simple comma / semi-colon based syntax or as a JSON structure. If facilities are not specified, preloaded facilities from the map document are used in the analysis. If an empty json object is passed (‘{}’) preloaded facilities are ignored.

barriers

The set of barriers loaded as network locations during analysis. Barriers can be specified using a simple comma/semicolon-based syntax or as a JSON structure. If barriers are not specified, preloaded barriers from the map document are used in the analysis. If an empty json object is passed (‘{}’), preloaded barriers are ignored.

polyline_barriers

The set of polyline barriers loaded as network locations during analysis. If polyline barriers are not specified, preloaded polyline barriers from the map document are used in the analysis. If an empty json object is passed (‘{}’), preloaded polyline barriers are ignored.

polygon_barriers

The set of polygon barriers loaded as network locations during analysis. If polygon barriers are not specified, preloaded polygon barriers from the map document are used in the analysis. If an empty json object is passed (‘{}’), preloaded polygon barriers are ignored.

travel_mode

Travel modes provide override values that help you quickly and consistently model a vehicle or mode of transportation. The chosen travel mode must be preconfigured on the network dataset that the service area service references.

attribute_parameter_values

A set of attribute parameter values that can be parameterized to determine which network elements can be used by a vehicle.

default_breaks

A comma-separated list of doubles. The default is defined in the network analysis layer.

exclude_sources_from_polygons

A comma-separated list of string names. The default is defined in the network analysis layer.

merge_similar_polygon_ranges

If true, similar ranges will be merged in the result polygons. The default is defined in the network analysis layer.

output_lines

The type of lines(s) generated. The default is as defined in the network analysis layer. Values: esriNAOutputLineNone | esriNAOutputLineTrueShape | esriNAOutputLineTrueShapeWithMeasure

output_polygons

The type of polygon(s) generated. The default is as defined in the network analysis layer.

overlap_lines

Indicates if the lines should overlap from multiple facilities. The default is defined in the network analysis layer.

overlap_polygons

Indicates if the polygons for all facilities should overlap. The default is defined in the network analysis layer.

splitLines_at_breaks

If true, lines will be split at breaks. The default is defined in the network analysis layer.

split_polygons_at_breaks

If true, polygons will be split at breaks. The default is defined in the network analysis layer.

trim_outer_polygon

If true, the outermost polygon (at the maximum break value) will be trimmed. The default is defined in the network analysis layer.

trim_polygon_distance

If polygons are being trimmed, provides the distance to trim. The default is defined in the network analysis layer.

trim_polygon_distance_units

If polygons are being trimmed, specifies the units of the trimPolygonDistance. The default is defined in the network analysis layer.

return_facilities

If true, facilities will be returned with the analysis results. Default is false.

return_barriers

If true, barriers will be returned with the analysis results. Default is false.

return_polyline_barriers

If true, polyline barriers will be returned with the analysis results. Default is false.

return_polygon_barriers

If true, polygon barriers will be returned with the analysis results. Default is false.

out_sr

The well-known ID of the spatial reference for the geometries returned with the analysis results. If outSR is not specified, the geometries are returned in the spatial reference of the map.

accumulate_attribute_names

The list of network attribute names to be accumulated with the analysis. The default is as defined in the network analysis layer. The value should be specified as a comma separated list of attribute names. You can also specify a value of none to indicate that no network attributes should be accumulated.

impedance_attribute_name

The network attribute name to be used as the impedance attribute in analysis. The default is as defined in the network analysis layer.

restriction_attribute_names

The list of network attribute names to be used as restrictions with the analysis. The default is as defined in the network analysis layer. The value should be specified as a comma separated list of attribute names. You can also specify a value of none to indicate that no network attributes should be used as restrictions.

restrict_u_turns

Specifies how U-Turns should be restricted in the analysis. The default is as defined in the network analysis layer. Values: esriNFSBAllowBacktrack | esriNFSBAtDeadEndsOnly | esriNFSBNoBacktrack | esriNFSBAtDeadEndsAndIntersections

output_geometry_precision

The precision of the output geometry after generalization. If 0, no generalization of output geometry is performed. The default is as defined in the network service configuration.

output_geometry_precision_units

The units of the output geometry precision. The default value is esriUnknownUnits. Values: esriUnknownUnits | esriCentimeters | esriDecimalDegrees | esriDecimeters | esriFeet | esriInches | esriKilometers | esriMeters | esriMiles | esriMillimeters | esriNauticalMiles | esriPoints | esriYards

use_hierarchy

If true, the hierarchy attribute for the network should be used in analysis. The default is as defined in the network layer. This cannot be used in conjunction with outputLines.

time_of_day

The date and time at the facility. If travelDirection is set to esriNATravelDirectionToFacility, the timeOfDay value specifies the arrival time at the facility. if travelDirection is set to esriNATravelDirectionFromFacility, the timeOfDay value is the departure time from the facility. The time zone for timeOfDay is specified by timeOfDayIsUTC.

time_of_day_is_utc

The time zone or zones of the timeOfDay parameter. When set to false, which is the default value, the timeOfDay parameter refers to the time zone or zones in which the facilities are located. Therefore, the start or end times of the service areas are staggered by time zone.

travel_direction

Options for traveling to or from the facility. The default is defined in the network analysis layer. Values: esriNATravelDirectionFromFacility |

esriNATravelDirectionToFacility

return_z

If true, Z values will be included in saPolygons and saPolylines geometry if the network dataset is Z-aware. The default is false.

overrides

Optional dictionary. Specify additional settings that can influence the behavior of the solver. A list of supported override settings for each solver and their acceptable values can be obtained by contacting Esri Technical Support.

preserve_objectid

Optional Boolean. If True, all objectid values are maintained. The default is False.

future

Optional boolean. If True, a future object will be returned and the process will not wait for the task to complete. The default is False, which means wait for results.

ignore_invalid_locations

If true, the solver will ignore invalid locations. Otherwise, it will raise an error. Default is true.

geometry_precision

Optional Integer. Use this parameter to specify the number of decimal places in the response geometries returned by solve operation. This applies to x/y values only (not m- or z-values).

geometry_precision_z

Optional Integer. Use this parameter to specify the number of decimal places in the response geometries returned by solve operation. This applies to z values only.

geometry_precision_m

Optional Integer. Use this parameter to specify the number of decimal places in the response geometries returned by solve operation. This applies to m values only.

ClosestFacilityLayer

class arcgis.network.ClosestFacilityLayer(url, gis=None)

The Closest Facility Network Layer which has common properties of Network Layer as well as some attributes unique to Closest Facility Layer only.

solve_closest_facility(incidents, facilities, barriers=None, polyline_barriers=None, polygon_barriers=None, travel_mode=None, attribute_parameter_values=None, return_directions=False, directions_language=None, directions_style_name=None, directions_length_units=None, directions_time_attribute_name=None, return_cf_routes=True, return_facilities=False, return_incidents=False, return_barriers=False, return_polyline_barriers=False, return_polygon_barriers=False, output_lines=None, default_cutoff=None, default_target_facility_count=None, travel_direction=None, out_sr=None, accumulate_attribute_names=None, impedance_attribute_name=None, restriction_attribute_names=None, restrict_u_turns=None, use_hierarchy=True, output_geometry_precision=None, output_geometry_precision_units=None, time_of_day=None, time_of_day_is_utc=None, time_of_day_usage=None, return_z=False, overrides=None, preserve_objectid=False, future=False, ignore_invalid_locations=True, directions_output_type=None, return_traversed_edges=None, return_traversed_junctions=None, return_traversed_turns=None, geometry_precision=None, geometry_precision_z=None, geometry_precision_m=None)

The solve operation is performed on a network layer resource of type closest facility (layerType is esriNAServerClosestFacilityLayer). You can provide arguments to the solve route operation as query parameters.

Parameter

Description

facilities

The set of facilities loaded as network locations during analysis. Facilities can be specified using a simple comma / semi-colon based syntax or as a JSON structure. If facilities are not specified, preloaded facilities from the map document are used in the analysis. If an empty json object is passed (‘{}’) preloaded facilities are ignored.

incidents

The set of incidents loaded as network locations during analysis. Incidents can be specified using a simple comma / semi-colon based syntax or as a JSON structure. If incidents are not specified, preloaded incidents from the map document are used in the analysis.

barriers

The set of barriers loaded as network locations during analysis. Barriers can be specified using a simple comma / semi-colon based syntax or as a JSON structure. If barriers are not specified, preloaded barriers from the map document are used in the analysis. If an empty json object is passed (‘{}’) preloaded barriers are ignored.

polyline_barriers

The set of polyline barriers loaded as network locations during analysis. If polyline barriers are not specified, preloaded polyline barriers from the map document are used in the analysis. If an empty json object is passed (‘{}’) preloaded polyline barriers are ignored.

polygonBarriers

The set of polygon barriers loaded as network locations during analysis. If polygon barriers are not specified, preloaded polygon barriers from the map document are used in the analysis. If an empty json object is passed (‘{}’) preloaded polygon barriers are ignored.

travel_mode

Travel modes provide override values that help you quickly and consistently model a vehicle or mode of transportation. The chosen travel mode must be preconfigured on the network dataset that the routing service references.

attribute_parameter_values

A set of attribute parameter values that can be parameterized to determine which network elements can be used by a vehicle.

return_directions

If true, directions will be generated and returned with the analysis results. Default is false.

directions_language

The language to be used when computing directions. The default is the language of the server’s operating system. The list of supported languages can be found in REST layer description.

directions_output_type

Defines content, verbosity of returned directions. The default is esriDOTStandard. Values: esriDOTComplete | esriDOTCompleteNoEvents | esriDOTInstructionsOnly | esriDOTStandard | esriDOTSummaryOnly

directions_style_name

The style to be used when returning the directions. The default is as defined in the network layer. The list of supported styles can be found in REST layer description.

directions_length_units

The length units to use when computing directions. The default is as defined in the network layer. Values: esriNAUFeet | esriNAUKilometers | esriNAUMeters | esriNAUMiles | esriNAUNauticalMiles | esriNAUYards | esriNAUUnknown

directions_time_attribute_name

The name of network attribute to use for the drive time when computing directions. The default is as defined in the network layer.

return_cf_routes

If true, closest facilities routes will be returned with the analysis results. Default is true.

return_facilities

If true, facilities will be returned with the analysis results. Default is false.

return_incidents

If true, incidents will be returned with the analysis results. Default is false.

return_barriers

If true, barriers will be returned with the analysis results. Default is false.

return_polyline_barriers

If true, polyline barriers will be returned with the analysis results. Default is false.

return_polygon_barriers

If true, polygon barriers will be returned with the analysis results. Default is false.

output_lines

The type of output lines to be generated in the result. The default is as defined in the network layer. Values: esriNAOutputLineTrueShape | esriNAOutputLineTrueShapeWithMeasure | esriNAOutputLineStraight | esriNAOutputLineNone

default_cutoff

The default cutoff value to stop traversing.

default_target_facility_count

The default number of facilities to find.

travel_direction

Options for traveling to or from the facility. The default is defined in the network layer. Values: esriNATravelDirectionFromFacility | esriNATravelDirectionToFacility

out_sr

The spatial reference of the geometries returned with the analysis results.

accumulate_attribute_names

The list of network attribute names to be accumulated with the analysis. The default is as defined in the network layer. The value should be specified as a comma separated list of attribute names. You can also specify a value of none to indicate that no network attributes should be accumulated.

impedance_attribute_name

The network attribute name to be used as the impedance attribute in analysis. The default is as defined in the network layer.

restriction_attribute_names

The list of network attribute names to be used as restrictions with the analysis. The default is as defined in the network layer. The value should be specified as a comma separated list of attribute names. You can also specify a value of none to indicate that no network attributes should be used as restrictions.

restrict_u_turns

Specifies how U-Turns should be restricted in the analysis. The default is as defined in the network layer. Values: esriNFSBAllowBacktrack | esriNFSBAtDeadEndsOnly | esriNFSBNoBacktrack | esriNFSBAtDeadEndsAndIntersections

use_hierarchy

If true, the hierarchy attribute for the network should be used in analysis. The default is as defined in the network layer.

output_geometry_precision

The precision of the output geometry after generalization. If 0, no generalization of output geometry is performed. The default is as defined in the network service configuration.

output_geometry_precision_units

The units of the output geometry precision. The default value is esriUnknownUnits. Values: esriUnknownUnits | esriCentimeters | esriDecimalDegrees | esriDecimeters | esriFeet | esriInches | esriKilometers | esriMeters | esriMiles | esriMillimeters | esriNauticalMiles | esriPoints | esriYards

time_of_day

Arrival or departure date and time. Values: specified by number of milliseconds since midnight Jan 1st, 1970, UTC.

time_of_day_is_utc

The time zone of the timeOfDay parameter. By setting timeOfDayIsUTC to true, the timeOfDay parameter refers to Coordinated Universal Time (UTC). Choose this option if you want to find what’s nearest for a specific time, such as now, but aren’t certain in which time zone the facilities or incidents will be located.

time_of_day_usage

Defines the way timeOfDay value is used. The default is as defined in the network layer. Values: esriNATimeOfDayUseAsStartTime | esriNATimeOfDayUseAsEndTime

return_z

If true, Z values will be included in the returned routes and compressed geometry if the network dataset is Z-aware. The default is false.

overrides

Optional dictionary. Specify additional settings that can influence the behavior of the solver. A list of supported override settings for each solver and their acceptable values can be obtained by contacting Esri Technical Support.

preserve_objectid

Optional Boolean. If True, all objectid values are maintained. The default is False.

future

Optional boolean. If True, a future object will be returned and the process will not wait for the task to complete. The default is False, which means wait for results.

ignore_invalid_locations

If true, the solver will ignore invalid locations. Otherwise, it will raise an error. Default is true.

return_traversed_edges

Optional boolean. Specify whether traversed edges will be returned by the service.

return_traversed_junctions

Optional boolean. Specify whether traversed junctions will be returned by the service.

return_traversed_turns

Optional boolean. Specify whether traversed turns will be returned by the service.

geometry_precision

Optional Integer. Use this parameter to specify the number of decimal places in the response geometries returned by solve operation. This applies to x/y values only (not m- or z-values).

geometry_precision_z

Optional Integer. Use this parameter specify the number of decimal places in the response geometries returned by solve operation. This applies to z-value only.

geometry_precision_m

Optional Integer. Use this parameter to specify the number of decimal places in the response geometries returned by solve operation. This applies to m-value only.

NetworkDataset

class arcgis.network.NetworkDataset(url, gis=None)

A network dataset containing a collection of network layers including route layers, service area layers and closest facility layers.

property closest_facility_layers

List of closest facility layers in this network dataset

classmethod fromitem(item)

Creates a network dataset from a ‘Network Analysis Service’ Item in the GIS

property od_cost_matrix_layers

List of OD Cost Matrix Layers

Returns

List

property route_layers

List of route layers in this network dataset

property service_area_layers

List of service area layers in this network dataset

ODCostMatrixLayer

class arcgis.network.ODCostMatrixLayer(url, gis=None)

OD Cost Matrix Layer is part of the Network Layer services. It allows users to generate cost matrix data for a given set of input.

retrieve_travel_modes()

Identify all the valid travel modes that have been defined on the network dataset or in the portal if the GIS server is federated

Returns

Dictionary

solve_od_cost_matrix(origins, destinations, default_cutoff=None, default_target_destination_count=None, travel_mode=None, output_type='Sparse Matrix', time_of_day=None, time_of_day_is_utc=None, barriers=None, polyline_barriers=None, polygon_barriers=None, impedance_attribute_name=None, accumulate_attribute_names=None, restriction_attribute_names=None, attribute_parameter_values=None, restrict_u_turns=None, use_hierarchy=True, return_origins=False, return_destinations=False, return_barriers=False, return_polyline_barriers=False, return_polygon_barriers=False, out_sr=None, ignore_invalid_locations=True, return_z=False, overrides=None, future=False, geometry_precision=None, geometry_precision_z=None)

The Origin Destination Cost Matrix service helps you to create an origin-destination (OD) cost matrix from multiple origins to multiple destinations. An Origin Destination Cost Matrix is a table that contains the cost, such as the travel time or travel distance, from every origin to every destination. Additionally, it ranks the destinations that each origin connects to in ascending order based on the minimum cost required to travel from that origin to each destination. When generating an OD Cost Matrix, you can optionally specify the maximum number of destinations to find for each origin and the maximum time or distance to travel when searching for destinations.

The results from the Origin Destination Cost Matrix service often become input for other spatial analyses where the cost to travel on the street network is more appropriate than straight-line cost.

The travel time and/or distance for each origin-destination pair is stored in the output matrix (default) or as part of the attributes of the output lines, which can have no shapes or a straight line shape. Even though the lines are straight, they always store the travel time and/or travel distance based on the street network, not based on Euclidean distance.

Parameter

Description

origins

Required FeatureLayer/SeDF/FeatureSet. Specifies the starting points from which to travel to the destinations.

destinations

Required FeatureLayer/SeDF/FeatureSet. Specifies the ending point locations to travel to from the origins.

default_cutoff

Optional Float. Specify the travel time or travel distance value at which to stop searching for destinations. The default value is None which means to search until all destinations are found for every origin. The units are the same as the impedance attribute units.

default_target_destination_count

Optional Integer. Specify the number of destinations to find per origin. The default value is None which means to search until all destinations are found for every origin.

travel_mode

Optional String. Choose the mode of transportation for the analysis.

output_type

Optional String. Specify the type of output returned by the service. Allowed value: Sparse Matrix (default), Straight Lines, or No Lines.

time_of_day

Optional Datetime. The time_of_day value represents the time at which the travel begins from the input origins. If a value of now is passed, the travel begins at current time.

time_of_day_is_utc

Optional Boolean. Specify the time zone or zones of the time_of_day parameter. The default is as defined in the network layer.

barriers

Optional FeatureLayer/SeDF/FeatureSet. Specify one or more points that act as temporary restrictions or represent additional time or distance that may be required to travel on the underlying streets.

polyline_barriers

Optional FeatureLayer/SeDF/FeatureSet. Specify one or more lines that prohibit travel anywhere the lines intersect the streets.

polygon_barriers

Optional FeatureLayer/SeDF/FeatureSet. Specify polygons that either prohibit travel or proportionately scale the time or distance required to travel on the streets intersected by the polygons.

impedance_attribute_name

Optional String. Specify the impedance. The default is as defined in the network layer.

accumulate_attribute_names

Optional String. Specify whether the service should accumulate values other than the value specified for impedance_attribute_names.

The default is as defined in the network layer. The parameter value should be specified as a comma-separated list of names.

restriction_attribute_names

Optional String. Specify which restrictions should be honored by the service.

attribute_parameter_values

Optional String. Specify additional values required by an attribute or restriction.

restrict_u_turns

Optional String. Restrict or permit the route from making U-turns at junctions. The default is as defined in the network layer.

Values: esriNFSBAllowBacktrack | esriNFSBAtDeadEndsOnly |

esriNFSBNoBacktrack | esriNFSBAtDeadEndsAndIntersections

use_hierarchy

Optional Boolean. Specify whether hierarchy should be used when finding the shortest paths. The default value is true.

return_origins

Optional Boolean. Specify whether origins will be returned by the service. The default value is false.

return_destinations

Optional Boolean. Specify whether origins will be returned by the service. The default value is false.

return_barriers

Optional Boolean. Specify whether barriers will be returned by the service. The default value is false.

return_polyline_barriers

Optional Boolean. Specify whether polyline barriers will be returned by the service. The default value is false.

return_polygon_barriers

Optional Boolean. Specify whether polygon barriers will be returned by the service. The default value is false.

out_sr

Optional Integer. Specify the spatial reference of the geometries.

ignore_invalid_locations

Optional Boolean. Specify whether invalid input locations should be ignored when finding the best solution. The default is True.

return_z

Optional Boolean. Include z values for the returned geometries if supported by the underlying network. The default value is false.

overrides

Optional Dict. Specify additional settings that can influence the behavior of the solver.

future

Optional boolean. If True, a future object will be returned and the process will not wait for the task to complete. The default is False, which means wait for results.

geometry_precision

Optional Integer. Use this parameter to specify the number of decimal places in the response geometries returned by solve operation. This applies to x/y values only (not m- or z-values).

geometry_precision_z

Optional Integer. Use this parameter specify the number of decimal places in the response geometries returned by solve operation. This applies to z-value only.

Returns

Dictionary or NAJob when future=True

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.