Luftdatenpumpe: Adjusting location labels with a focus on sensor id instead of station id

1. Grafana: Adjusting the table view

Adding another column to the table view at Luft: LDI » luftdaten.info map for Frankfurt/Main (DE) is easy. Just add station_id to the projection list at the SQL query at luftdatenpumpe/luftdatenpumpe/grafana/dashboard-map.json at 0.21.1 · earthobservations/luftdatenpumpe · GitHub, like

SELECT osm_country_code, state_and_city, name_and_id, sensor_type_name, sensor_id 
FROM ldi_network 
WHERE station_id IN ($ldi_station_id) AND sensor_type_name IN ($ldi_station_sensortype) 
ORDER BY osm_country_code, state_and_city, name_and_id, sensor_type_name;

2. Grafana: Adjusting the map view

On the documentation about Luftdaten-Viewer Grafana, you will find this command to create a mapping file consumed by the Map Panel, in order to display the overlays on circles.

luftdatenpumpe stations --network=ldi --source=postgresql://luftdatenpumpe@localhost/weatherbase \
  --target=json.flex+stream://sys.stdout \
  --target-fieldmap='key=station_id\|str,name=road_and_name_and_id'

The database column road_and_name_and_id in database view ldi_network will get used to format the overlay string in Grafana.

road_and_name_and_id is defined at luftdatenpumpe.target.rdbms.create_views, along with other alias fields. On this spot, it will be possible to add more display formats.

With kind regards,
Andreas.


P.S.: Just to get you an idea how this looks like on the database side, when everything is in place, and how you can start to explore the data in order to customize the system to your needs.

weatherbase=> SELECT DISTINCT(road_and_name_and_id) FROM ldi_network WHERE road_and_name_and_id LIKE '%Frankfurt%' LIMIT 5;
          road_and_name_and_id
----------------------------------------
 Adickesallee, Frankfurt (#16544)
 Am Auerborn, Frankfurt (#65922)
 Am Musikheim, Frankfurt (Oder) (#4363)
 Antoninusstraße, Frankfurt (#8311)
 Atzelbergstraße, Frankfurt (#10108)
(5 rows)
weatherbase=> SELECT road_and_name_and_id, station_id FROM ldi_network WHERE road_and_name_and_id LIKE '%Frankfurt%' LIMIT 5;
           road_and_name_and_id            | station_id
-------------------------------------------+------------
 Am Musikheim, Frankfurt (Oder) (#4363)    |       4363
 Buschmühlenweg, Frankfurt (Oder) (#58456) |      58456
 Buschmühlenweg, Frankfurt (Oder) (#58456) |      58456
 Buschmühlenweg, Frankfurt (Oder) (#58474) |      58474
 Buschmühlenweg, Frankfurt (Oder) (#58474) |      58474
(5 rows)
1 Like