ZeusWPI / Haldis

Haldis is your friendly neighbourhood servant. He exists so lazy fucks like you and me don't need to keep tabs of who is ordering what from where.
Other
13 stars 15 forks source link

Use OSM-API to fetch metadata #198

Open pietervdvn opened 2 years ago

pietervdvn commented 2 years ago

The API can be used via https://www.openstreetmap.org/api/0.6/<osmid, e.g. way/123>. If the header Accepts: application/json, a file such as the following is returned:

{
  "license": "http://opendatacommons.org/licenses/odbl/1-0/",
  "elements": [
    {
      "type": "node",
      "lat": 51.0267345,
      "lon": 3.7100248,
      "tags": {
        "addr:housenumber": "413",
        "addr:street": "Voskenslaan",
        "amenity": "fast_food",
        "cuisine": "friture",
        "delivery": "no",
        "diet:vegetarian": "yes",
        "friture:oil": "animal",
        "name": "De Fritoloog",
        "opening_hours": "Mo-Fr 11:30-14:00,17:00-22:30; Su 18:00-22:30",
        "takeaway": "yes",
        "website": "https://www.defritoloog.be/"
      }
    }
  ]
}

The tags you'll need are: 'phone', 'addr:*', 'website'. Furthermore, opening_hours can be really interesting too (and can be parsed with https://invent.kde.org/libraries/kopeninghours or https://github.com/opening-hours/pyopening_hours)