ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Hilfe
  • Sign Out
ArcGIS Desktop

ArcGIS Online

Die Mapping-Plattform für Ihre Organisation

ArcGIS Desktop

Ein vollständiges professionelles GIS

ArcGIS Enterprise

GIS in Ihrem Unternehmen

ArcGIS Developers

Werkzeuge zum Erstellen standortbezogener Apps

ArcGIS Solutions

Kostenlose Karten- und App-Vorlagen für Ihre Branche

ArcGIS Marketplace

Rufen Sie Apps und Daten für Ihre Organisation ab.

  • Dokumentation
  • Support
Esri
  • Anmelden
user
  • Eigenes Profil
  • Abmelden

Analytics

  • Home
  • Applied Analysis
  • Python

Analyzing traffic accidents in space and time, workflow

    Download the data package

    Workflow using ArcGIS Pro

    ArcGIS Pro icon

    Hinweis:

    The steps below are based on ArcGIS Pro 2.6 but should work fine for later software releases as well. To follow the steps below, you may download and unzip the data in the data package provided, or improvise using your own data. If you don't have ArcGIS Pro, you can get a trial version of the software and use it to complete the steps in this workflow.

    Explore space-time patterns

    1. If you haven't done so already, download and unzip the data package provided at the top of this workflow.
    2. Double-click the CrashAnalysis.ppkx to open it.
    3. Right-click the AllCrashes10to15 layer in the Contents pane and select Attribute Table.
    4. Notice the CRASH_DT (date) field. If you sort on this field (double-click the field header), you will notice the data range from January 1, 2010 to December 31, 2015. You will use this date field to structure the crash data into space-time hexagon bins. Close the table.
    5. Find and open the Create Space Time Cube tool and run it with the parameters below. The cube is a netCDF file so it must be created in a folder rather than inside a file geodatabase. With this quick exploration of traffic accident trends between 2010 and 2015, you will look at 2-mile hexagons using 16-week time periods. You could certainly spend a lot of time here experimenting with different hexagon sizes and time periods, but since this isn't your final analysis (your final analysis will be more refined), these parameters will work well.
      • Input Features : AllCrashes10to15
      • Output Space Time Cube : the name of your output cube such as AllCrashes.nc
      • Time Field : CRASH_DT
      • Time Step Interval : 16 Weeks
      • Time Step Alignment : End time
      • Distance Interval : 2 Miles
      • Aggregation Shape Type : Hexagon grid
        Create Space Time Cube tool parameters
    6. When the tool finishes, hover over the tool name in the progress bar to display the messages. Click the pop-out button Pop-out messages to examine details about the cube you created.
      Accessing Pro messages
      Expanding the message window
    7. Read through the messages and notice that there has been a statistically significant increase in vehicle crashes (point counts) over time. Close the pop-out message pane.
    8. Click the back arrow on the Geoprocessing pane. Find and open the Emerging Hot Spot Analysis tool.
      Clearing the search results
      Clicking the back arrow to begin a new search
    9. Run the Emerging Hot Spot Analysis tool with the parameters below. You will take the default values for the Neighborhood Distance and Neighborhood Time Step parameters.
      • Input Space Time Cube : AllCrashes.nc
      • Analysis Variable : COUNT
      • Output Features : the name of your output feature class such as CrashTrends
        Emerging Hot Spot Analysis tool parameters
    10. Hinweis:

      Whenever possible and appropriate, create your workflow output in a geodatabase rather than as a shapefile. Field names in shapefile output may be truncated, and there are other advantages to using a geodatabase to store your data.

    11. Examine the results. There is a specific definition for each trend category on the map. If you hover over the tool name in the progress bar and click the pop-out button Pop-out messages, you will see a Summary of Results table indicating there are three New Hot Spots, nineteen Consecutive Hot Spots, and a number of Diminishing Cold Spots. Look up the definitions for each of these trend patterns.
      Crash count space-time trends
      Crash rate space-time trends
    12. Hinweis:

      The warning messages are informational only. They tell you the Neighborhood Distance and Neighborhood Time Step used for the analysis.

      Visualizing the space-time cube in 3D will allow you to explore these trend categories further. You may follow instructions for doing this now, or complete the detailed instructions for 3D visualization provided later in this workflow.

    Identify crash hot spots on the road network

    The crash trend analysis above is a great exploratory workflow. Unfortunately, the analysis is not based on the road network. In this next analysis, you will associate each crash with the underlying road network and look for crash hot spot locations.

    1. You are going to snap the crash points to the roads. The Snap tool changes feature geometry, so begin by creating a copy of the crash data. Click the back arrow on the Geoprocessing pane, then find and run Copy Features:
      • Input Features : AllCrashes10to15
      • Output Feature Class : the name of the new feature class such as Crash_Points
    2. Detailinformationen:

      The RoadSegment feature class used in the next step was derived from road polylines for Brevard County. Creating it involved 3 steps:

      • Clipping the roads to the Brevard County border.
      • Erasing the roads associated with the John F. Kennedy Space Center, since no crash data is collected there. Including roads where no crash data is recorded would bias your results.
      • Splitting the longest road segments, where appropriate.

    3. Find and open the Snap tool and run it with the following parameters to make sure all crash points fall on a road.
      • Input Features : Crash_Points
      • Snap Environment :
        • Features : RoadSegments
        • Type : Edge
        • Distance : 0.25 Miles
        Snap tool parameters
    4. The Snap tool may take several minutes to complete.
      Tipp:

      The Distance parameter value reflects the farthest distance the Snap tool will move a crash point to place it on a road. The Near tool can show you how far each crash point is from a road. Using the Imagery Basemap, you can examine points farthest from roads and determine an appropriate cut-off distance for snapping.

    5. Once all points are located on a road, you can use the Spatial Join tool to count the number of accidents associated with each road segment. Find and open the Spatial Join tool. Use the parameters shown below. You will remove all but the UniqID and Fatalities attributes from the Field Map (by clicking the red X that appears when you hover over a field you want to remove). You will use the summed Fatalities data later in the workflow.
      • Target Features : RoadSegments
      • Join Features : Crash_Points
      • Output Feature Class : the name of your output feature class such as Road_Crash_Counts
      • Field Map of Join Features : UniqID, First; Fatalities, Sum
        Spatial Join tool parameters
    6. For each road segment, compute a per mile, per year, crash rate (see page 21 of Road Safety Information Analysis).
    7. Find and open the Add Field tool and use it to create a new double precision rate field:
      • Input Table : Road_Crash_Counts
      • Field Name : CrashRate
      • Field Type : Double
      • Field Alias : Average crashes per mile per year
    8. Find and open the Calculate Field tool and use it to compute the crash rate. The numerator for the crash rate calculation is the number of crashes associated with each road segment (the Join_Count field) and the denominator is the number of years of data (6 years) times the length of the road segment (Shape_Length).
      • Input Table : Road_Crash_Counts
      • Field Name : Average crashes per mile per year
      • Expression : !Join_Count! / (6 * !Shape_Length!)
        Calculate Field tool parameters
    9. Run hot spot analysis on the road crash rates. Find and open the Hot Spot Analysis tool and run it with the following parameters.
      • Input Feature Class : Road_Crash_Counts
      • Input Field : Average crashes per mile per year
      • Output Feature Class : the name of your output feature class such as Road_Crash_HotSpots
      • Conceptualization of Spatial Relationships : Get spatial weights from file
      • Weights Matrix File : CrshNtw360ft30.swm included with the case study data package
      • Apply False Discovery Rate (FDR) Correction : checked
        Hot Spot Analysis tool parameters
        Network hot spots
        Statistically significant clusters of high crash rates along the Brevard County road network
    10. Hinweis:

      You may ignore the warning message about differing coordinate systems.

      Tipp:

      You may want to reduce the line width for the Not Significant category so the other categories stand out more. To do this, click on the yellow line symbol in the legend and from the symbol tab Symbol tab on the Format Line Symbol pane, change the Line Width to 0.25.

      Changing line width

      Detailinformationen:

      Hot spot analysis integrates spatial relationships directly into its mathematics. These relationships are defined formally through values called spatial weights. Spatial weights are organized into a spatial weights matrix and stored as a spatial weights matrix file. The spatial weights matrix file (.swm) used in all of the hot spot analyses in this case study was created using the Generate Network Spatial Weights tool and StreetMap Premium for ArcGIS. To keep the crash hot spots local, the Impedance Cutoff was set to 360 feet (about the length of a football field). This is the minimum stopping sight distance for a vehicle traveling 45MPH. To ensure the results are reliable, while still keeping the size of the spatial weights matrix manageable, the Maximum Number of Neighbors was limited to 30. Make sure when you use the Generate Network Spatial Weights tool with your own data that the Use Hierarchy in Analysis parameter is unchecked or the tool may take a very long time to complete.

    Compare crash hot spots

    Next you will compare the locations of hot spots for all traffic accidents (the map above) to the locations of hot spots for fatal traffic accidents.

    1. Use the Add Field tool, again, to create a second crash rate field for fatalities.
      • Input Table : Road_Crash_Counts
      • Field Name : FatalityRate
      • Field Type : Double
      • Field Alias : Average fatalities per mile per year
    2. The sum of fatalities (the Fatalities field) is Null for road segments with no fatal accidents. You could select the Null records and change them to zero before computing the fatality rate, or you can do this in one step with the Calculate Field tool as shown below.
    3. Use the Calculate Field tool to compute the number of fatalities per year per mile.
      • Input Table : Road_Crash_Counts
      • Field Name : Average fatalities per mile per year
      • Expression : 0 if not !Fatalities! else !Fatalities! / (6 * !Shape_Length!)
        Calculating the fatality rate
    4. To facilitate comparison of the crash hot spots for all vehicle accidents with the hot spots for crashes involving fatalities, create a new map view. Click on the Insert tab and click New Map.
      Inserting a new map
      Inserting a new map
    5. This creates a new map view called Map1. Change the Basemap to match your other map view by clicking the Map tab in the main menu (next to the Insert tab) and selecting the Basemap button.
    6. With Map1 active, open the Hot Spot Analysis tool from the Project pane. This is a short cut. It will put the output into the active map view but look for inputs in the original Map view.
      Accessing the Geoprocessing History
      Opening a previously run tool from the Project pane
    7. Run Hot Spot Analysis using the following parameters:
      • Input Feature Class : Road_Crash_Counts
      • Input Field : Average number of fatalities per mile per year
      • Output Feature Class : the name of your output feature class such as FatalityHotSpots
      • Conceptualization of Spatial Relationships : Get spatial weights from file
      • Weights Matrix File : CrshNtw360ft30.swm included with the case study data package
      • Apply False Discovery Rate (FDR) Correction : checked
    8. This should put the output from Hot Spot Analysis onto the new map view. If it doesn't, you can copy the layer from one map view and paste it into the new map view.
    9. View the crash hot spots next to the fatality hot spots by dragging Map1 to the center of the map view and placing it in the right position.
      Position Map1 next to Map
      Positioning two maps side by side
    10. Link the side by side maps by clicking on the View tab, Link Views, and selecting Center And Scale.
      Linking map views
      Linking the scale and focus of two side by side maps
    11. Zoom in and pan around the map. Notice where the locations for fatal crash rate hot spots differ from the hot spot locations for all crash rates. The red areas on the left side map below are traffic accident (crash rate) hot spots. The red areas on the right side map are fatality crash rate hot spots.
      Comparing hot spot maps
      Comparing hot spots for all crash rates (left) to fatality crash rate hot spots (right)
    12. You may interpret the red hot spots in the map on the right as locations with higher risk for fatal traffic accidents. Understanding why these locations are more prone to fatalities is a first step toward designing remediation strategies to prevent future accidents in those locations. Comparing the fatality rate hot spots to other rates such as accidents involving seat belt non-use, distracted driving, or alcohol may provide further clues.

    Identifying the most dangerous hours and days of the week

    While the analyses above are now based on the underlying road network, an improvement, in the act of aggregating the crash point data to the roads you have stripped away all temporal attributes. In this next section of the workflow, you will summarize the crash data by day of the week (DOW) and by hour of the day (HOD) to understand peak days and time periods for traffic accidents.

    1. Drag Map1 back to the center of the display and activate the original Map view.
      Stacking map views
      Re-centering the map views
    2. Right-click on the AllCrashes10to15 layer and select Attribute Table. Notice there are fields for hour of the day (CRASH_HOD) and day of the week (CRASH_DOW). Close the attribute table.
    3. Right-click on the AllCrashes10to15 layer again and select Create Chart. Click on Line Chart.
      Creating a chart
      Creating a line chart
    4. In the Chart pane, set the Data parameters as follows.
      • X-Axis: Date or Number : CRASH_HOD
      • Aggregation : COUNT
      • Data series : From one field split into series
      • Split by : CRASH_DOW
    5. Order the series values and set appropriate colors for each day of the week. You may want to make the work week (Monday through Friday) shades of green, for example, and the weekend days shades of brown.
      Setting chart fields, order, and colors
    6. Set the chart titles on the General tab.
      • Chart title : Traffic Accidents
      • X axis title : Hour of the Day (24 hour clock)
      • Y axis title : Number of Crashes
        Setting the chart titles
    7. Undock the chart and resize it as appropriate.
      ArcGIS Pro line chart
      Line chart showing traffic accidents by day of the week and hour of the day
    8. You may turn lines off within the graph by clicking on their entries in the legend. To focus on the lines associated with the workweek, for example, click on Saturday and Sunday to turn them off.
      Weekends excluded
      Focusing on the workweek
    9. Notice the strong peak in traffic accidents occurring during the afternoon commute between 3:00 and 5:00 p.m.. You will analyze this further.
    10. Close the line chart. If you want to open it again later, click the chart button on the Contents pane.
      Re-opening a chart
      Existing charts may be reopened from the Contents pane.

    Compare peak crash days and times to the overall pattern of crashes

    To create the rate variable for crashes occurring weekdays between 3:00 and 5:00 p.m., you could follow the same steps you used above to create the fatality rate hot spot map. Instead, however, you are going to create a model tool that will allow you to examine any subset of crashes such as: Fridays between 11:00 AM and 1:00 p.m., or weekends between 1:00 and 3:00 AM.

    Hinweis:

    You may follow the steps below to create the model, or you may use the finished models that come with the project package. Look in the Toolboxes folder in the Project pane. CrashAnalysis.tbx contains all of the completed models. If you elect to use the completed models, you may skim over the steps for creating the model below and proceed directly to the step where you run the model (Step 9).

    1. From the Analysis tab, click the ModelBuilder button to open a new model view canvas.
      New model
      Creating a new model
    2. Give your model a name by clicking the Properties button in the ModelBuilder tab and setting the following:
      • Name : CreateDayTimeHotSpotMap
      • Label : Create Day/Time Hot Spot Map
    3. Add data inputs to your model:
      1. Add the crash data.

        1. Drag AllCrashes10to15 from the Contents pane onto the model canvas.
        2. Right-click on the AllCrashes10to15 model element and select Rename. Change the name to Crash Data.
        3. Right-click on Crash Data and select Parameter. This labels the element with a P and will allow you to pass selected records to this model later in the workflow.

      2. Create a file variable.

        1. Right-click on the model canvas and select Create Variable. From the drop down, select File for the Variable Data Type.
        2. Double-click the File model element to bring up the browse dialog. Navigate to the CrshNtw360ft30.swm file included with the data package.
          File variable
          Adding model inputs

      3. Create a day of the week variable.

        1. Right-click on the model canvas and, again, select Create Variable. Check the Mulitple values check box. This variable will be type String.
        2. Right-click this multiple value string variable and select Rename. Name this element Days. Right-click the Days variable and select Parameter.

      4. Create starting and ending hour of the day variables.

        1. Right-click on the model canvas and select Create Variable. Create two variables of type Long. These two variables are not multiple value.
        2. Rename one of the variables to be Beginning Hour and the other one to be Ending Hour. Right-click both of these again and select Parameter.

      5. Define valid variable values.

        1. Click on the Properties button above the model canvas and select the Parameters tab.
          Parameter properties
          Accessing variable properties
        2. Click inside the Filter column for the Beginning Hour parameter. Select Range and indicate an appropriate value range from 0 to 23 (0 is midnight, and 23 is 11:00 p.m.). Repeat for the Ending Hour parameter.
          Valid numbers
          Setting a range for the beginning and ending hour variables
        3. Click inside the Filter column for the Days variable, select Value List, and provide the day of the week values as shown:
          Value List
          Creating a value list for the Days variable

      6. Set default variable values.

        1. Double-click the beginning and ending hour model elements and set default values (such as 1 for beginning and 3 for ending).
        2. Double-click the Days element and set a default value such as Monday and Tuesday.

      7. Save the model.
        Model inputs
        Model inputs
    4. Following the steps below, use the Calculate Value model utility to create an SQL expression for selecting records based on days of the week and hours of the day. You will define a new function called p which takes three arguments: Days, Beginning Hour, and Ending Hour. The function will build the SQL string based on the values of these three arguments.
      1. On the ModelBuilder menu, select Utilities and Calculate Value.
        Model utilities
        Adding model utility tools to your model
      2. Double-click the Calculate Value tool in the model and set the parameters as follows:

        • Expression : p("%Days%", %Beginning Hour%, %Ending Hour%)
          Hinweis:

          String variables must be enclosed in quotes.

        • Code Block :

          def p (days, start, end):                       # define a function called p
              sStart = str(start)                         # convert the start hour to a string
              sEnd = str(end)                             # convert the end hour to a string
              d = days.split(";")                         # get the day strings into a list called d
              ss = "(CRASH_DOW = '" + d[0]                # select CRASH_DOW equal to d[0]
              for i in range (1, len(d)):                 # loop through list of other days, if any
                  ss = ss + "' OR CRASH_DOW = '" + d[i]   # tag on any additional days in the list
              ss = ss + "') AND (CRASH_HOD >= " + sStart  # add the HOD search
              ss = ss + " AND CRASH_HOD <= " + sEnd + ")" # finish the SQL statement
              return ss
          
        • Data Type : SQL Expression
          Calculate Value code block
          Creating an SQL expression to select crashes by day of week and hour of day

        Tipp:

        Use the Tab key to create indentation in the Code Block rather than spaces.

      3. Right-click the output_value model element and Rename it SQL Expression
      4. In the Geoprocessing pane, search for Select Layer By Attribute. Right-click on it in the Search Results and select Add To Model.
        Add tool to model
        Adding a geoprocessing tool to your model
      5. Create a connection from the Crash Data element to the Select Layer By Attribute tool, setting the connection to Layer Name or Table View.
        Connecting model elements
        Connecting model elements
      6. Create a connection for the Expression parameter from the SQL Expression model element to the Select Layer By Attribute tool.
      7. Rename the Updated Layer or Table View element to Selected Crashes. Save the model.
        First part of model
        Model components for creating an SQL statement to select the crash points for analysis
    5. Extend the model to snap the selected crash points to the roads.
      1. Add the Copy Features tool to the model canvas (search for Copy Features in the Geoprocessing pane, then right-click on it in the Search Results, and select Add to Model).
      2. Add the Snap tool to the model canvas.
      3. Add the Spatial Join tool to the model canvas.
      4. Connect the Selected Crashes model element to Copy Features. It is important to create a copy of your data before using Snap because Snap changes feature geometry. Rename the Copy Features Output Feature Class to Crash Points.
      5. Connect Crash Points to the Snap tool as Input Features. Rename the output from the Snap tool (the element called Snapped Input Features) to Crash Points Snapped to Roads.
      6. Double-click the Snap tool in the model and set the parameters as follows.

        • Input Features : Crash Points
        • Snap Environment
          • Features : RoadSegments
          • Type : EDGE
          • Distance : 0.25 Miles

      7. Connect RoadSegments to the Spatial Join tool as the Target Features. Connect Crash Points Snapped to Roads to the Spatial Join tool as the Join Features. Rename the spatial join output to Road Segment Crash Counts.
        Snap points to roads
        Model component for snapping selected crash point to roads
    6. Extend the model to create a crash rate field.
      1. Drag the Add Field and Calculate Field tools on the model canvas (or right-click them in the Geoprocessing search pane and select Add To Model).
      2. Right-click the Add Field tool and select Create Variable From Parameter where the parameter is Field Name.
        Create a variable from a tool parameter
        Creating model variables from tool parameters
      3. Double-click the Field Name variable and set the default value to be CrashRate. Rename the Field Name variable to New Rate Field Name. Make the New Rate Field Name model element a parameter by right-clicking it and selecting Parameter. Making it a parameter will allow the user to provide a name for the rate field.
      4. Connect Road Segment Crash Counts to the Add Field tool as the Input Table.
      5. Double-click the Add Field tool and set the Field Type to Double.
      6. Rename the output element coming from the Add Field tool to be Crash Counts. Rename the output element coming from the Calculate Field tool to be Crash Rates.
      7. Connect Crash Counts to the Calculate Field tool as the Input Table.
      8. Double-click the Calculate Field tool model element and set the parameters as follows.

        • Input Table : Crash Counts
        • Field Name : %New Rate Field Name%
        • Expression : !Join_Count! / (6 * !Shape_Length!)
        Calculate rate field
        Model to calculate rate field
        Model components for calculating a crash rate

    7. Extend the model to perform a hot spot analysis.
      1. Add the Hot Spot Analysis tool to the model canvas.
      2. Connect CrshNtw360ft30.swm to the Hot Spot Analysis tool as the Weights Matrix File. Connect the Crash Rates model element to the Hot Spot Analysis tool as the Input Feature Class.
      3. Rename the Hot Spot Analysis tool output to Selected Crash Hot Spot Map.
      4. Double-click the Hot Spot Analysis tool and set the parameters as follows.

        • Input Feature Class : Crash Rates
        • Input Field : %New Rate Field Name%
        • Output Feature Class : the name of your output feature class such as SelectedCrashHotSpots
        • Conceptualization of Spatial Relationships : Get spatial weights from file
        • Weights Matrix File : CrshNtw360ft30.swm
        • Apply False Discovery Rate (FDR) : checked

      5. Right-click Selected Crash Hot Spots and select both the Parameter and the Add to Display options. Your model should look similar to the one below. Save the model.

        The grouping shown (yellow boxes) matches the steps above but isn't necessary for the model to run. To group elements within the model, select them and click on the Group button in the ModelBuilder tab.

        Create Day/Time hot spot maps
        Model to create day/time hot spot maps

    8. From the Create Day/Time Hot Spot Map model view, Validate and Run the model one time through to make sure there are no errors. Running once in the model view not only checks the model tool's integrity, but also ensures the output rendering is connected correctly. Remove the output from the Contents pane before moving on to the next step.
      Buttons to validate and run a model
    9. Activate the Map view and run your model tool again from the Geoprocessing pane (either search for the new model tool like you would any geoprocessing tool, or locate the model tool in the Project pane under Toolboxes). Select all weekday crashes occurring between 3:00 and 5:00 p.m..
      • Crash Data : AllCrashes10to15
      • Days : Monday; Tuesday; Wednesday; Thursday; Friday
      • Beginning Hour : 15
      • Ending Hour : 17
      • New Rate Field Name : a rate field name such as WrkWk3to5
      • Selected Crash Hot Spot Map : an output feature class name such as WrkWk3to5HotSpots
        Create Day/Time Hot Spot Map tool parameters
    10. Copy the WrkWk3to5HotSpots layer from the Contents pane of the Map view to the Contents pane of the Map1 view.
    11. View the hot spot map of all crashes (Road_Crash_ HotSpots on the Map view) side by side with the hot spot map of workweek 3:00 to 5:00 p.m. crashes (WrkWk3to5HotSpots on the Map1 view). Turn off drawing for all other layers. Below, for example, notice there is a crash rate hot spot for weekdays 3:00 to 5:00 p.m. on US Route 1 just north of Florida State Road 404 (Pineda Causeway). This hot spot is particular to the workweek afternoon commute.
      Comparing hot spot results
      Crash rate hot spots for all day and times (left) compared to crash rate hot spots for the afternoon workweek commute (right)
    12. Activate the Map view. All of the data you will need to build the model tools below are in this view.

    Create yearly space-time hot spot maps

    Next you will modify the Create Day/Time Hot Spot Map model to create yearly road network hot spot maps for particular days of the week and particular hours during the day.

    Hinweis:

    You may follow the steps below to create the model, or you may use the finished models that come with the project package. Look in the Toolboxes folder in the Project pane. CrashAnalysis.tbx contains all of the completed models. If you elect to use the completed models, you may skim over the steps for creating the model and proceed directly to the step where you run the model (step 28).

    1. Click the New button on the ModelBuilder tab.
      New model
      Creating a new model
    2. This new model is going to call a second model to run the hot spot tool on yearly subsets of the selected crashes. Click the Properties button and set the General model attributes as follows. Save the model.
      • Name : DayTimeAnalysis
      • Label : Analyze Day/Time Hot Spot Trends
    3. If not already open, open your Create Day/Time Hot Spot Map model tool or the xCreate Day/Time Hot Spot Map model tool that came with the data package. Do this by expanding Toolboxes and the project toolbox in the Project pane, right-clicking on the model tool and selecting Edit.
    4. Copy to your new model canvas the model elements for selecting crashes associated with particular days of the week and hours of the day. Include the Days, Beginning Hour, Ending Hour, Crash Data, Calculate Value, and Select Layer By Attribute model elements.
    5. You may need to reset the value ranges and value list for the copied parameters. Check this by following the steps below.
      1. Activate the Analyze Day/Time Hot Spot Trends model view.
      2. Click the Properties button and select the Parameters tab.
      3. Check that the Days parameter has a complete value list (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, and Sunday).
      4. Check that the Beginning Hour and Ending Hour variables have value ranges from 0 to 23.
    6. Save the model.
    7. You will come back to finish the Analyze Day/Time Hot Spot Trends model tool after completing a new model to create yearly hot spot maps.
    8. Open another new model (click the New Model button).
    9. Click the Properties button and set the Name and Label values as shown below, then save the model.
      • Name : YearlyHotSpotMaps
      • Label : Yearly Hot Spot Maps
    10. This third model will iterate over the values in the CRASH_YEAR field, creating a hot spot map for each year. You will almost always put iterator tools in their own individual models because every tool in a model with an iterator must also iterate. If you have done any programming, an iterator works like a loop. Everything within the loop should be in the model with the iterator. Everything outside the loop should be in the calling model.
    11. Add the Iterate Feature Selection iterator to the blank model canvas.
      Model iterators
      Adding an iterator to your model
    12. Double-click the Iterate Feature Selection model element and set the parameters as follows, then right-click AllCrashes10to15 and make it a model Parameter.
      • In Features : AllCrashes10to15 (it may show as AllCrashes10to15:1)
      • Field : CRASH_YEAR
        Iterate Feature Selection tool parameters
        Setting the iterator parameters to process each year of crash data
    13. Copy the rest of the first model (Create Day/Time Hot Spot Map), beginning with Copy Features and ending with the Hot Spot Analysis tool, and paste it underneath Iterate Feature Selection. Connect the output from Iterate Feature Selection to Copy Features.
    14. Remove (uncheck) the Parameter and Add To Display setting for the output from Hot Spot Analysis.
      Uncheck Parameter and Add To Display
      Neither Parameter nor Add To Display should be checked.
    15. Add the Parameter setting to the RoadSegments model element.
      Model to process crashes per year
      Reuse the components of your previous model
    16. As is, the resultant hot spot map will not include the associated year data; you will fix that next.
    17. Drag the Add Field and Calculate Field tools to the bottom of the model (or find them in the Geoprocessing search pane, right-click, and select Add To Model).
    18. Set the parameters for Add Field as follows.
      • Input Table : Selected Crash Hot Spot Map
      • Field Name : AnalysisYear
      • Field Type : Long
    19. The Value variable from Iterate Feature Selection has the year value. You will use it to populate the AnalysisYear field.
    20. Connect the output from Add Field to be the input to Calculate Field, and set the Calculate Field parameters as shown below.
      • Input Table : SelectedCrashHotSpots
      • Field Name : AnalysisYear
      • Expression : %Value%
    21. This model creates a separate hot spot map for each year. You will tag the hot spot output with the year and send a list of all of the hot spot map path names back to the calling model so they can be merged into a single output feature class.
    22. Double-click the output from the Hot Spot Analysis tool (called Selected Crash Hot Spot Map) and set the default value to CrashHotSpots%Value%.
    23. Add the Collect Values model utility to the end of your model.
      Model utilities
      Adding the Collect Values utility to your model
    24. Connect the output from Calculate Field to be the input to Collect Values.
    25. Rename the output from Collect Values to Crash Hot Spot Maps. Also make this output a Parameter.
    26. Validate and save the model.
    27. The Yearly Hot Spot Maps model is shown below (again, the yellow grouping boxes are instructional only; they are not necessary for the model to work correctly):
      Model to create yearly hot spot maps
      Final Yearly Hot Spot Maps model tool
      Now you can finish up the Analyzing Day/Time Hot Spot Trends model you started earlier. (Make sure you saved the Yearly Hot Spot Maps model tool before proceeding).
    28. Click on the Analyze Day/Time Hot Spot Trends model view to activate it.
    29. From the Project Pane, under Toolboxes, drag the Yearly Hot Spot Maps model onto the Analyzing Day/Time Hot Spot Trends model canvas. Connect the Selected Crashes output from the first part of the model to the Yearly Hot Spot Maps model tool in the second part of the model. Delete the extra AllCrashes10to15 element from the model.
      Building model 2
      Building the Analyze Day/Time Hot Spot Trends model tool
    30. Add the Merge tool to the end of the model. Connect the output from the Yearly Hot Spot Maps model to the Merge tool.
    31. Rename the output from the Merge tool to be Space Time Hot Spots. Make it a model tool Parameter. Double-click the Merge tool model element and set a default name for the tool output such as CrashTrends.
      Analyze Day/Time Trends model
      Analyze Day/Time Hot Spot Trends model tool
    32. Click the Properties button and make sure the model tool parameters are in the right order and have the value list (Monday through Sunday) and value range settings (0 to 23) expected.
      Model parameters
      Setting the model tool parameter properties
    33. Validate and save the model.
    34. Activate the Map view and run the Analyze Day/Time Hot Spot Trends model from the Project pane (double-click on the model tool to launch it in the Geoprocessing pane).
      • Crash Data : AllCrashes10to15
      • Days : Monday; Tuesday; Wednesday; Thursday; Friday
      • Beginning Hour : 15 (3:00 p.m.)
      • Ending Hour : 17 (5:00 p.m.)
      • Space Time Hot Spots : the name of your output feature class such as WrkWk3to5CrashTrends
        Analyze Day/Time Hot Spot Trends tool parameters
    35. The model may take a while to complete (about 15 minutes). The output map will be symbolized with a single color. Not very interesting at all, but wait until you see what comes next!

    Use 3D visualization to explore yearly crash hot spot trends

    The output from the Analyze Day/Time Hot Spot Trends model is six years of stacked road segments attributed with hot spot analysis results. Consequently, you can only see the trends in the data by viewing the output in 3D. The steps below guide you through creating a 3D visualization that will allow you to assess space-time crash hot spot trends intersection by intersection and roadway by roadway.

    1. Find and open the Apply Symbology From Layer tool and run it with the following parameters:
      • Input Layer : WrkWk3to5CrashTrends
      • Symbology Layer : Road_Crash_HotSpots
    2. From the Insert tab select to create a New Scene view. Change the Basemap if you wish.
      New scene
      Creating a new scene
    3. Copy the WrkWk3to5CrashTrends layer from the Map view to the Scene view (right-click the layer in the Contents pane for the Map view and select Copy, then right-click on the Scene in the Scene view and select Paste). The layer will be added to the scene as a 2D layer. Drag the layer up to the 3D Layers group. The layer may not draw yet; that's okay.
    4. Elevation services are automatically enabled whenever you create a new scene. You are going to extrude the road segments from the map surface, so to ensure the surface is completely flat you will disable the elevation service for this scene.
    5. Right-click the Scene in the Contents pane and select Properties.
      Scene properties
      Accessing scene properties
    6. On the Elevation Surface tab, expand Elevation sources and remove any that appear there.
      Disable elevation sources
      Disabling elevation sources on the scene
    7. Zoom in to an area of the map to speed up drawing (zoom in to Melbourne, for example).
    8. Right-click on the WrkWk3to5CrashTrends layer and select Properties.
      1. On the General tab, set the Out beyond distance to 2,000,000 ft.
      2. On the Elevation tab, set the following.

        • Features are : At an absolute height
        • Additional feature elevation using : An expression ([AnalysisYear]-2010) * 100

        Layer elevation properties
        Setting the layer elevation properties
    9. Click the Appearance tab to extrude the road segments. Set the Type to Base Height. Click the Expression button and set the height to 95.
      Extrude options
      Extruding the road segments
      3D visualization
      Building the 3D visualization
    10. To better focus on the hot spot areas, click on the symbol associated with crash rates that aren't statistically significant and set the color to No color.
      Hot spot focus
      Setting No color for road segments that aren't statistically significant
    11. Tilt and zoom into the map to focus in on road segments with persistently high crash rates. The map below shows an area near Eau Gallie, just north of Melbourne.
      Crash trends 3D
      Afternoon commute crash trends along Highway 1 near Montreal Avenue, Eau Gallie

    Opportunities

    With the Analyze Day/Time Hot Spot Trends model tool, Lixin can explore other days of the week and hours of the day. Understanding the spatial and temporal patterns of traffic accidents will help him recommend very specific remediation strategies to help prevent future crashes. Knowing which roadways and intersections are associated with persistently high rates for crashes involving alcohol, for example, may direct the locations of DUI check points.

    • Story Map
    • Analyzing traffic accidents in space and time - analysis overview
    • References and resources for learning more

    ArcGIS Desktop

    • Startseite
    • Dokumentation
    • Support

    ArcGIS

    • ArcGIS Online
    • ArcGIS Desktop
    • ArcGIS Enterprise
    • ArcGIS Developers
    • ArcGIS Solutions
    • ArcGIS Marketplace

    Über Esri

    • Über uns
    • Karriere
    • Esri Blog
    • User Conference
    • Developer Summit
    Esri
    Wir sind an Ihrer Meinung interessiert.
    Copyright © 2021 Esri. | Datenschutz | Rechtliches