ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for 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
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Update Traffic Incidents

Available with Network Analyst license.

  • Summary
  • Usage
  • Syntax
  • Code Sample
  • Environments
  • Licensing Information

Summary

Creates a point feature class containing live traffic-incident data from a web service. Traffic incidents include events such as accidents and road construction.

Usage

  • You need to have an account with one of the data providers listed in the Provider parameter before this tool can download traffic data.

  • If you run this tool multiple times using the same output workspace and feature class name, all prior features are deleted before creating new ones.

Syntax

UpdateTrafficIncidents_na (provider, user_name, password, regions, incidents_feature_class_location, incidents_feature_class_name, {time_zone_boundaries}, {time_zone_id_field})
ParameterExplanationData Type
provider

Choose the name of your traffic-incident data provider and the region.

  • NAVTEQ North America
  • NAVTEQ Europe
  • NAVTEQ South America
  • NAVTEQ Oceania
  • NAVTEQ Middle East & Africa
  • TomTom North America
  • TomTom Europe
String
user_name

The user name authorized by the data provider to download incidents. The tool fails to execute if the user name cannot be authenticated by the data provider.

If the Provider parameter is TomTom North America or TomTom Europe, use APIKEY as the parameter value.

String
password

The password provided by the data provider to download traffic-incident data. The tool fails to execute if the password cannot be authenticated by the data provider.

Encrypted String
regions
[regions,...]

Enter the regions for which you want to download traffic-incident data. To download all available regions, type "#".

String
incidents_feature_class_location

The geodatabase in which the output feature class will be created. This workspace must already exist.

Workspace; Feature Dataset
incidents_feature_class_name

The name of the feature class to be created. If the tool has been run before and the feature class already exists, the tool will delete existing features and create new ones based on the most recent incident data.

String
time_zone_boundaries
(Optional)

The polygon feature class whose features delineate time zones. By providing this feature class, incidents occurring within time zone boundaries can be reported in local time, not only Coordinated Universal Time.

If you don't provide a time zone boundaries feature class, incident start and end times can be reported in Coordinated Universal Time (UTC) only; all local time fields are assigned null values. Occasionally, certain incidents from traffic feeds such as weather events have null geometries. In this situation, the local time fields are assigned null values even if the time zone boundaries feature class is provided.

Setting the Time Zone ID Field property is required if you provide a time-zone-boundaries feature class.

Feature Layer
time_zone_id_field
(Optional)

The text field, from the time-zone-boundaries feature class, that contains Windows time zone identifiers.

The values in this field correspond to time zone keys in the Windows registry. You can follow similar steps to those outlined in the topic Adding time zones to a network dataset to find proper time zone names for the polygons in your input feature class.

Field

Code Sample

UpdateTrafficIncidents example 1 (Python window)

The following Python window script demonstrates how to use the Update Traffic Incidents tool.

import arcpy
arcpy.na.UpdateTrafficIncidents("NAVTEQ North America", "myUserName",
                                "myPassword",
                                ["New England", "New York/Northern NJ/Connecticut"],
                                "C:/Data/Traffic.gdb","Traffic_Incidents",
                                "C:/data/TimeZones.gdb/NATimeZones", "MSTIMEZONE")
UpdateTrafficIncidents example 2 (workflow)

The following stand alone Python script describes how the Update Traffic Incidents tool can be used to download traffic incidents as a feature class in an ArcSDE geodatabase. The script can be run as a Windows Scheduler Task or a cron job on Linux so that the traffic incidents are updated at regular intervals. The feature class can be used to publish a feature service.

# Name: UpdateTrafficIncidents_Workflow.py
# Description: Downloads traffic incidents as a feature class in an ArcSDE
#              geodatabase. The script can be run as a Windows Scheduler Task or
#              a cron job on Linux so that the traffic incidents are updated at 
#              regular intervals. The feature class can be used to publish a 
#              feature service. 

#Import system modules
import arcpy
from arcpy import env


#Set local variables
trafficIncidentsStorage = "C:/data/TrafficIncidentsStorage.sde"
incidentsFeatureClass = "NAVTEQ_NorthAmerica_Incidents"
provider = "NAVTEQ North America"
username = "Replace with your username"
password = "Replace with your password"
#download data for all regions
regions = "#"
timeZoneBoundaries = "C:/data/TimeZones.gdb/NATimeZones"
timeZonesID = "MSTIMEZONE"

try:
    #Update Traffic Data. Use default values for remaining parameters
    arcpy.na.UpdateTrafficIncidents(provider,username,password, regions,
                                    trafficIncidentsStorage, incidentsFeatureClass,
                                    timeZoneBoundaries, timeZonesID)

    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)

Environments

  • Current Workspace

Licensing Information

  • ArcGIS for Desktop Basic: Yes
  • ArcGIS for Desktop Standard: Yes
  • ArcGIS for Desktop Advanced: Yes

Related Topics

  • Output from Update Traffic Incidents
  • What is traffic data?
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal