ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

StreetDirectionsProperties

  • Summary
  • Discussion
  • Properties
  • Code sample

Summary

Provides read and write access to street directions properties, allowing you to customize the directions output from your network analysis layers. The StreetDirectionsProperties can be read from and set on a SolverProperties object obtained through the GetSolverProperties function.

Discussion

The StreetDirectionsProperties object provides read and write access to street directions properties, allowing you to customize the directions output from your network analysis layers.

Properties that can be read and set include language, lengthUnits, styleName, timeAttribute, outputSpatialReference.

The StreetDirectionsProperties object is only available on Route, Closest Facility, and Vehicle Routing Problem network analysis layers. The other network analysis layer types do not support output directions. Additionally, the StreetDirectionsProperties object will not be available on network analysis layers built on network datasets that don't support directions. A Python None object will be returned if the layer is not supported.

After modifying the properties of the StreetDirectionsProperties object, the corresponding layer can be immediately used with other functions and geoprocessing tools. There is no refresh or update of the layer required to honor the changes modified through the object.

Properties

PropertyExplanationData Type
language
(Read and Write)

Specifies the language in which the output text directions are written. Available languages depend on the languages installed on your machine and can be checked using the ListDirectionsLanguages function.

String
lengthUnits
(Read and Write)

Specifies the distance units used to measure lengths in the output text directions. The units must be one of the following string values:

  • Feet
  • Kilometers
  • Meters
  • Miles
  • NauticalMiles
  • Yards
String
styleName
(Read and Write)

Specifies the style of the output text directions. Different styles are available for different applications, such as printing, using on a navigation device, or routing a pedestrian. Available styles depend upon the styles installed on your machine and can be checked using the ListDirectionsStyleNames function.

String
timeAttribute
(Read and Write)

Specifies the time-based network dataset cost attribute that is used to calculate the travel time in the output directions. The available timeAttribute values are a property of the network dataset. You can list the cost attributes in your network dataset using a network dataset describe object.

String
outputSpatialReference
(Read and Write)

Indicates the spatial reference for the output directions feature class. Input to this attribute must be a spatial reference object.

SpatialReference

Code sample

StreetDirectionsProperties example (Workflow)

Reads a route layer, sets its length units to kilometers, and generates directions features.

import arcpy

try:

    arcpy.CheckOutExtension("network")

    #Get the route layer object from a layer named "Route" in
    #the table of contents.
    RouteLayer = arcpy.mapping.Layer(r'C:\Data\Route.lyr')

    # Get the solver properties of the layer.
    SolverProps = arcpy.na.GetSolverProperties(RouteLayer)

    # Get the street directions properties
    DirectionsProps = SolverProps.streetDirectionsProperties

    # Set the lengthUnits to Kilometers
    DirectionsProps.lengthUnits = "Kilometers"

    # Set the outputSpatialReference to web mercator
    sr = arcpy.SpatialReference(3785)
    DirectionsProps.outputSpatialReference = sr

    # Get the time attribute used for directions for use later
    timeAttribute = DirectionsProps.timeAttribute

    #Generate directions features and save them to disk.
    arcpy.na.GenerateDirectionsFeatures(RouteLayer,
                                        r'C:\Data\Directions.gdb\RouteDirections')

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)

Related topics

  • Route analysis
  • Closest facility analysis
  • Vehicle routing problem analysis

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal