Functions to pull data from Geotab's Altitude API and process it.
- Clone this repo.
- Copy the file
passwords_template.txtand name the copypasswords.txt. Replace the contents with your Geotab DB(s) and user account(s). - Update the paths found in
api_wrapper/user_params.pyto match your local directories. - Set up a Python environment including the following packages:
- polars, numpy, pickle, json, glob, time, datetime, ratelimit
pip install mygeotab- If you need to create and upload custom Geotab regions: geopandas, shapely, geojson
- You may need to install python-certifi-win32 or a similar package to run queries on the API while connected a VPN.
To get started, try running one of the example Jupyter notebooks:
api_query_examples/regional_domicile_examples.ipynb: outputs a set of parquet files combining Regional Domicile results across multiple queriesapi_query_examples/stop_analytics_examples.ipynb: outputs a set of parquet files for Stop Analytics across multiple queriesapi_query_examples/other_query_examples.ipynb: outputs a polars DataFrame for each query output
Results across queries from the Regional Domicile and Stop Analytics APIs are combined into a single set of .parquet files. Each parquet file can be read into a polars DataFrame with pl.read_parquet(filename):
all_metadata_new.parquet: Parameters (filters used, etc.) for each API query.all_subzone_definitions_new.parquet: Descriptions of each subzone. Subzones are origin-destination pair for O-D analyses, or geographic zones for Stop Analytics or Regional Domicile results; they may also be specific to a time slice (e.g., day of week). Shape definitions (stored as strings) for each subzone for each query. For Stop Analytics or Regional Domicile results,ZoneIdlinks this table tosubzone_definitions. For O-D analyses,ZoneIdlinks toOrigin_ZoneIdorDestination_ZoneIdinsubzone_definitions.all_results_new.parquet: Results from all queries. This can be joined tometadataonQuery_ID, or can be joined tosubzone_infotable onQuery_ID+Subzone.
This repo is associated with NREL Software Record SWR-24-77.
