Skip to content

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

License

Notifications You must be signed in to change notification settings

WSDOT-GIS/wsdot-traffic-gp

Repository files navigation

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 wsdottraffic

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

Start-Process pip "install wsdottraffic" -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.

wsdottraffic

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.

wsdottraffic.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

You can get help for any of the scripts using the -h argument.

python -m wsdottraffic -h

wsdottraffic.gp / wsdottrafficgp

  • 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 wsdottraffic.gp.creategdb

or

wsdottrafficgp

wsdottraffic.dumpjson / wsdottraffic

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

python -m wsdottraffic

or

wsdottraffic

wsdottraffic.gp.multipointtopoint / multipointtopoint

Calls the Multipart to Singlepart tool for each multipoint feature class in a geodatabase. Added feature classes will have the same name as its source, but with the added suffix _singlepart.

python -m wsdottraffic.gp.multipointtopoint YourGDBNameHere.gdb

or

multipointtosinglepoint YourGDBNameHere.gdb

Notes for developers

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

python -m src.wsdottraffic.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.