OpenStreetMapi logo OpenStreetMap

Hiking relations in wiki table

Postitas Cascafico kuupäeval 10. detsember 2018 – Italian (Italiano).

Intro

When adding several hiking routes, sometime it comes handy having updated tables in wiki format to be easily added in specific wiki pages.

Recipe

  • overpass query on area name
  • some awk insertions
  • pyhon script csv2wiki

overpass-query

This overpass query will generate a csv file(ie: stregna.csv) with local network hiking paths. Example output:

@id,name,ref,network
2071931,,747,lwn
6934010,Sentiero Italia - Tappa A14,SI,lwn
7112799,Sentiero Hum,,lwn

This awk will add OSM link to each relation:
$ awk -F “,” ‘FNR == 1 {print $0} FNR > 1 { print “[osm.org/relation/”$1” “$1”],”$2”,”$3”,”$4 }’ stregna.csv > stregna.txt

actual wiki formatting

Python script will generate the actual wiki text:
$ python csv2wiki stregna.txt > stregna.wiki

summarizing script

This script performs the steps above (here you can customize query with whatever relation tags). Just provide an OSM area name.

E-kirja ikoon Bluesky ikoon Facebooki ikoon LinkedIni ikoon Mastodoni ikoon Telegrami ikoon X-i ikoon

Arutelu

Kommentaar kasutajalt ikonor 10. detsember 2018, kell 17:24

Thanks for sharing.

I always thought that it would be nice to replace those routes wiki tables with dynamically generated ones in HTML/JavaScript.

There was an attempt to add a table tab to Overpass Turbo, but unfortunately didn’t complete.

Or a dedicated web page that can list relations of a given type for a specific area, e.g. using DataTables or similar, and maybe show a map next to it. Completion percentage could be calculated from the distance tag and the actual length of the way members.

Kommentaar kasutajalt qwerty22 11. detsember 2018, kell 22:55

Thanks for sharing. It is very useful for me.

kommenteerimiseks logi sisse