The scripts in this repository can be used to consume WSDOT Traveler Information API REST endpoints in ArcGIS software.
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
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.
See the modules' docstrings for more details on how to use the scripts.
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.
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.
You can get help for any of the scripts using the -h
argument.
python -m wsdottraffic -h
- 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
Downloads data from API and exports JSON files: one with the data and one with automatically detected field definitions.
python -m wsdottraffic
or
wsdottraffic
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
The example below shows how to run one of the scripts from within the project directory
python -m src.wsdottraffic.gp.creategdb
These are test scripts for use with the unittest Python module.
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.