How to Get All Sensor Indexes and Locations in a Fixed Region via Script

Hi everyone,

I’m working on a project that involves analyzing PurpleAir sensor data in a specific region (e.g., Dallas), and I’m trying to find a way to get a list of all outdoor sensors — including their sensor_index, latitude, and longitude — without manually clicking each sensor on the map.

What I’m hoping to do is:

  • Define a bounding box (e.g., lat/lon range for Dallas)

  • Use a script (Python preferred) to retrieve:

    • sensor_index

    • latitude

    • longitude

    • (optionally) sensor name or type

Is there a recommended way to do this using the PurpleAir API? Or is there a tool or endpoint that already provides this kind of bulk data?

Any help or examples would be greatly appreciated!

Thanks in advance :folded_hands:

3 Likes

Hi @Yunyao_Li

I’m not sure if this completely answers your question, but bounding boxes are supported. Have you seen this article: Finding Large Amounts of Sensor Indexes (Bounding Box API Call)?

Hi @Yunyao_Li,

You can use the PurpleAir API to get all sensors in a region. Define a bounding box and fetch data from https://www.purpleair.com/data.json using your read key. Then filter the results for sensors within your box and optionally by type (outdoor/indoor).

This will give you sensor_index, latitude, longitude, and name without clicking each sensor manually.