earthobservations / luftdatenpumpe

Acquire and process live and historical air quality data without efforts. Filter by station-id, sensor-id and sensor-type, apply reverse geocoding, store into time-series and RDBMS databases, publish to MQTT, output as JSON, or visualize in Grafana. Data sources: Sensor.Community (luftdaten.info), IRCELINE, and OpenAQ.
https://luftdatenpumpe.readthedocs.io/
GNU Affero General Public License v3.0
34 stars 3 forks source link

Add OSM-based synthetic geolocation field for micro-regions #52

Closed amotl closed 1 year ago

amotl commented 1 year ago

Dear @ohobby,

at Luftdatenpumpe: Aiming to focus on sensor id instead of station id, you asked about a different formatting of the popup label when displaying measurement values on the Panodata Map Panel.

This patch adds a corresponding improvement.

Field:   district_postcode_city_sensorid
Format:  District, Postcode, City (#SensorID)
Example: Regierungsbezirk Darmstadt, 60385, Frankfurt (#76777)

The new field can then be used on the step when exporting station metadata from PostGIS to JSON for the map panel:

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

You can update the installation within your virtualenv to the version within this branch on GitHub by running:

pip install --upgrade git+https://github.com/earthobservations/luftdatenpumpe@popup-label-dpcs

With kind regards, Andreas.

codecov[bot] commented 1 year ago

Codecov Report

Base: 55.89% // Head: 55.89% // No change to project coverage :thumbsup:

Coverage data is based on head (a3540c7) compared to base (4fae26d). Patch has no changes to coverable lines.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #52 +/- ## ======================================= Coverage 55.89% 55.89% ======================================= Files 3 3 Lines 297 297 ======================================= Hits 166 166 Misses 131 131 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `55.89% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=earthobservations#carryforward-flags-in-the-pull-request-comment) to find out more. Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=earthobservations). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=earthobservations)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

amotl commented 1 year ago

Oh, and you will also have to update the ldi_network database view.

luftdatenpumpe database \
  --network=ldi \
  --target=postgresql://luftdatenpumpe@localhost/weatherbase \
  --create-views --grant-user=grafana
ohobby commented 1 year ago

Hi @amotl ,

i was wrong with the "District" at OSM it is the Tag "suburb".

i have change it to: concat(concat_ws(', ', osm_suburb, osm_postcode, osm_city), ' ', sensor_id_suffix) AS suburb_postcode_city_sensorid

And it looks good, but how is it possible to remove the comma between postcode and city? Would it be possible to write the PM10 and PM2.5 values in the next line? image

Thanks, Oliver

amotl commented 1 year ago

Hi again,

thanks. Let's continue the discussion about this topic and its refinement at https://community.panodata.org/t/luftdatenpumpe-aiming-to-focus-on-sensor-id-instead-of-station-id/254/11.

With kind regards, Andreas.

ohobby commented 1 year ago

However, there is the problem that the sensor ID of the PM or the temperature/humidity sensor is sometimes displayed. The ID of the PM sensor should always be used.

amotl commented 1 year ago

Thank you. I have diverted your report to GH-57.