1 / 14

Automating Police Incident Data Management with Python: Geocoding and GIS Integration

This project presents a Python script designed to automate the extraction and geocoding of new police incident records from an SQL database, subsequently updating a GIS layer hourly. The script addresses challenges such as time-based queries and the geocoding process, ensuring efficiency in data management. Key functionalities include querying new records, geocoding, performing spatial joins, and writing logs for auditing. By scheduling this process, it allows for timely updates to critical public safety information while ensuring data integrity during each operation.

powa
Télécharger la présentation

Automating Police Incident Data Management with Python: Geocoding and GIS Integration

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Final ProjectGeog 375 Daniel Hewitt

  2. Project Summary • This script was designed to extract, at regular intervals, the newest records from a Police record management system, geocode and insert them into a production GIS police incident layer. Developing this script automates a process that without Python would be too time consuming to be practical. Python is especially useful in that the script is ran at regular intervals, in this case hourly, and then only processes those records from the last hour and inserts them into the production feature class. There were some challenges that were encountered in developing the script at all phases. These challenges included using time as a query variable, geocoding the raw data and creating the batch and task scheduler jobs.

  3. Project Steps • Select new records in the police SQL database from the last hour, this would be based on current time compared to a time stamp field in the table. • The script then geocodes the selected records using a geocoder in our SDE database. • Next, a spatial join is preformed to update a Reporting District field. • An append would be used to then write the geocoded records to the production GIS layer. • A log file is written to for auditing and troubleshooting should any issues arise and to provide a list of records that did not meet the geocoding standards. • Lastly, the script is ran as a batch process and scheduled task that is to be ran at an hourly interval.

  4. Workflow

  5. Import modules & set variables • All necessary Python modules are imported • Variables are created providing a path to all necessary input and output data locations

  6. Create log variables • Log is written to at various phases of the script • All print functions are mirrored in both Python Shell and in the log

  7. Create table views & feature layers • Table views and feature layers that are referenced are defined in this section of the script

  8. Set time variables & query • The time variables and query are established • The first section is just for verification and printing to the log and Shell, the second section is the query

  9. Select records using time variable • A search cursor is run to write values to the Shell and log, then the selection set is made

  10. Geocode records • Geocode process is ran creating an interim feature class • Job status information is printed and recorded in log

  11. Spatial Join • Spatial join is preformed in order to populate the Reporting Districts attribute field

  12. Append & Summary • Append is preformed and a final summary is sent to the log and Shell

  13. Log & Shell Print Output • Shell • Log

  14. Batch & Schedule • Batch file is created that executes the Python script • Scheduled job is ran using Windows Task scheduler that executes batch file.

More Related