The City of San Diego has installed over 4,000 "intelligent sensors" in streetlights across the entire city. The hope is to leverage the data from these sensors to improve liveability by optimizing traffic flow and parking, monitoring environmental conditions, and enhancing resident safety. The City welcomes public interaction with the data, but at the moment obtaining the data using the CityIQ API is not intuitive. This project's goal is to provide resources and code to simplify the process of downloading data of interest.
This map shows where sensors are installed across San Diego.
The goal of this project is to create tools that make it easier to download the data. Until then, this is the procedure:
-
(Optional) Download this CityIQ repository: [https://github.com/CityIQ/OnBoarding]
You get a lot of documentation if you download the repo, but you really only need to download these two files: NEW-CityIQ-OnBoarding-Collection-PostMigration.postman_collection.json and New-Environment-Please-Complete-Independently.postman_environment.json -
Download and install Postman
You may have to create a free Postman account to get this to work (I'm not sure, someone verify please?) -
Open Postman
a. Click the 'Import' button on the top left (Insert jpeg here)- Drag and drop your downloaded New-Environment-Please-Complete-Independently.postman_environment.json file here
- Go to the drop-down menu on the top right and select 'New-Environment-Please-Complete-Independently' (Insert jpeg here)
- Click the eye logo on the top right ('Environment quick look') (Insert jpeg here)
- Edit the
CURRENT VALUE
of the following variables. NOTE Some of these values change periodically. Look in the City documentation for the new values if necessary:client_id
: PublicAccessclient_secret
: qPKIadEsoHjyh226Snz7 (this is changed every 3 months; see the City website for the new value)tenant
: sandiegoparking_zone_id
: SD-IE-PARKINGtraffic_zone_id
: SD-IE-TRAFFICped_zone_id
: SD-IE-PEDESTRIANenv_zone_id
: SD-IE-ENVIRONMENTAL
- Click the eye logo again to close this window
b. Click the 'Import' button on the top left
- Drag and drop your downloaded NEW-CityIQ-OnBoarding-Collection-PostMigration.postman_collection.json file here
c. Expand the 'NEW-CityIQ-OnBoarding-Collection-PostMigration folder on the left
- Expand the Tokens folder
- Select 'GET client Token'
- Click the 'SEND' button on the right
This returns an access token that is good for 24 hrs. You will need to repeat this step on each day you want to work with the CityIQ API (you don't need to repeat steps a or b)
d. Now you're ready to query the streetlights database!
- Time - if you want to download data from a specific timeframe, you have to specify the start and end times (
startTime
andendTime
) in milliseconds since January 1, 1970 00:00:00 UTC. You can use this website to convert back and forth. - Location - if you want to limit your search to a geographic location, you have to enter boundary box information in latitude and longitude (
bbox
). The defaultbbox
set in the environment variables list is -90:-180,90:180, which is the entire world. (We need resources for ways to get that information. Here's one, but you need to have a specific address)
- CityIQ documentation
- Detailed description of data types available for each category. You might have to download this pdf to get it to open.
- CityIQ's basic guide to working with Postman (with examples of GET requests)
- The City of San Diego's Smart Streetlights overview