Schedule Calculate Prediction Zone tool

The prediction zones can be updated on a daily, weekly, or monthly recurring basis. This is especially useful in situations where daily prediction zones will be used to direct focused patrolling efforts. The Calculate Prediction Zone tool can be executed from Windows Task Scheduler on a defined schedule, and can be used to update either a local feature class on a file geodatabase or server, or on a hosted feature class in ArcGIS Online, Portal for ArcGIS, or ArcGIS Enterprise.

The input parameters specified in the tool can be configured as an argument to the script to automate the process in Windows Task Scheduler. Then the tool can be triggered to execute on a reoccurring date and time using the parameters.

Configure the Calculate Prediction Zones scripts

To configure the script to execute, run the Calculate Prediction Zones tool to verify the input parameters and complete the following steps.

  1. In ArcCatalog or the Catalog window in ArcMap , browse to MapsandGeodatabase\CrimeAnalysisTools.tbx\Repeat and Near Repeat toolset and open the Calculate Prediction Zones tool.
  2. Fill in values for each of the parameters. If you would like the scheduled updates to also update a published copy of the zones, include values for the optional publishing parameters.
  3. Click OK to run the tool and verify that the data updated successfully.
  4. Copy the input parameters from the tool message window into a text file. The text from the message window should appear similar to the following:

    C:\NearRepeatAnalysis\MapsandGeodatabase\CrimeAnalysis.gdb\NearRepeat\Burglaries OFFENDATE YESTERDAY 1500 572 21 6 CUMULATIVE "C:\NearRepeatAnalysis\MapsandGeodatabase\Output" "C:\NearRepeatAnalysis MapsandGeodatabase\CrimeAnalysis.gdb\NearRepeat\PredictionZones" 2 true ArcGIS Online MyUsername MyPassword http:// myorganization.maps.arcgis.com/ http://services.arcgis.com/1234OrGgUiD12345/arcgis/rest/services/PredictionZones/FeatureServer/0

Set up the Task Scheduler

Use Windows Task Scheduler to create a task to update your prediction on a specific schedule. By scheduling this tool the prediction zones layer will be updated.

  1. Open the Task Scheduler on the computer that is hosting the tools.
  2. Click Action > Create Task and name your task.
  3. Click the Actions tab and click New.
  4. Set Action to Start a Program.
  5. Browse to the location of your Python installation (for example, <default directory>\Python27\ArcGIS10.4\python.exe).
  6. In the Add arguments text box, copy the name of the script (calculate_prediction_zones.py) and the parameters from the text file.
  7. In the Start in text box, type the path to the folder where your script is and click OK.
  8. Click the Trigger tab, click New, and set a schedule for your task.
  9. Click OK.
Top