/wsdot-traffic-gp

Provides information from the WSDOT Traveler Information API to ArcGIS Software via Geoprocessing Scripts

Primary LanguagePythonThe UnlicenseUnlicense

wsdot-traffic-gp

The scripts in this repository can be used to consume WSDOT Traveler Information API REST endpoints in ArcGIS software.

Build Status

Setup

Install package

To install this package onto your computer using pip, use the following command. For more information on installing packages, see the Installing Packages tutorial from the PyPA Python Packaging User Guide.

pip install git+https://github.com/WSDOT-GIS/wsdot-traffic-gp.git

If you are running this command from PowerShell, you will need to have administrator privileges.

Start-Process pip "install git+https://github.com/WSDOT-GIS/wsdot-traffic-gp.git" -Verb RunAs

Default access code

You can set a default access code, so you don't need to provide it via function parameter or script argument, by setting an environment variable called WSDOT_TRAFFIC_API_CODE to the default access code.

Modules

See the modules' docstrings for more details on how to use the scripts.

wsdot.traffic

This module provides the ability to query the REST endpoints and return the results as a dictionary.

  • Note that this script has no ArcGIS dependencies and can be run without any ArcGIS software installed.
  • Should run in either v2.7+ or v3.5.2+ of Python.

wsdot.traffic.gp

Consume the REST endpoints and return the results as a file geodatabase.

  • Requires ArcPy
  • Should work with either ArcGIS Desktop or ArcGIS Pro, and the versions of Python that they come with.

Scripts

wsdot.traffic.gp.creategdb / createwsdottrafficgdb

  • Downloads data from API
  • Creates feature class and tables if not already existing
  • If tables exist, truncates them
  • Inserts the data into feature classes and tables inside of a file geodatabase.
  • Zips the file geodatabase (which is a folder w/ .gdb extension).
python -m wsdot.traffic.gp.creategdb

or

createwsdottrafficgdb

wsdot.traffic.dumpjson / dumpwsdottrafficjson

Downloads data from API and exports JSON files: one with the data and one with automatically detected field definitions.

python -m wsdot.traffic.dumpjson

or

dumpwsdottrafficjson

Notes for developers

The example below shows how to run one of the scripts from within the project directory

python -m src.wsdot.traffic.gp.creategdb

Unit tests (test_*.py)

These are test scripts for use with the unittest Python module.

PowerShell scripts for developers

The PowerShell scripts are intended for use by developers working on this project and are not used by consumers of the library. Use the Get-Help command for more info on these scripts.