[I have tried searching using google and the search option - I promise] I wish to embed an Open Streetmap Map into my website (which is easy using LeafletJS), and then I want to display the boundary for a "relation" you have stored. Looking at the xml I can see the relation is made up of multiple 'ways' and for each 'way' I could seek to download a 'node'. From here I could traverse the xml and locate each GPS co-ord and then add it programatically to the map using Leaflet but this seems (to me) overcomplicated. Is this what is generally done or is there a blindingly obvious programatic way that I have not seen? I can imagine this question should be directed here or to the Leaflet folks -so apologies if this is a wrong posting Howard asked 01 May '23, 16:30 hjp23 |
If you only want to use a single relation statically, and don't need updates then you can download the data in GeoJSON format from Overpass Turbo. I think Leaflet then allows you to use GeoJSON layers if you store it on your site somewhere. answered 01 May '23, 22:22 InsertUser Thank you! I must admit that when I went to Overpass I scratched my head as to how to find the "relation" from OSM - but a quick question with ChatGPT led to the following Overpass query [out:json]; relation(9456324); (._;>;); out; which then allowed me to download the GPS points as you describe. Perfect!
(02 May '23, 07:59)
hjp23
|
Unrelated to getting the Relation into Leaflet, if you're planning on using tiles from the "default" style then there's an associated usage policy linked to from the copyright page.