開放街圖標誌 OpenStreetMap 開放街圖

Quick and dirty OSM statistics with bash and jq

於 2020年一月10日 由 pangoSEEnglish發表。 上一次更新在 2020年一月11日。

This is the script I came up with to make some stats on the huts and shelters of Sweden. The data was fetched via overpass-turbo.

download the geojson from Overpass Turbo -> export or save as from JOSM.

example query: access!=private and (tourism=alpine_hut or tourism=wilderness_hut or (amenity=shelter and shelter_type!=public_transport)) in sweden

you can run this query from inside JOSM - see the JOSM wiki.

The script is here: https://gist.github.com/pangoSE/5294e835c9bead773e8036603a90b898

This was the output for Sweden:

$ ./stats.sh vin-190110.geojson 
Numbers of each type:
Shelters - total: 2629
Shelters - Lean to (sv. vindskydd): 793
Shelters - Basic hut (sv. stuga utan uppvärmning): 129
Shelters - Weather shelter (sv. väderskydd endast lämpad för kort uppehåll vid dåligt väder): 355
Shelters - Picnic shelter (sv. liten byggnad med tak, eldstad och skorsten i mitten): 251
Shelters - Unknown type: 1692
Wilderness huts: 43
Alpine huts: 82

Lean_to shelters details:
- has description tag: 29 - 3%
- has fireplace=yes: 305 - 38%
- has floor=wood: 7 - 0%
- has image: 18 - 2%
- has snowmobile=yes: 28 - 3%
- has water_source tag: 4 - 0%
- has wood_provided=yes: 3 - 0%

Basic huts details:
- has description tag: 16 - 12%
- has fireplace=yes: 52 - 40%
- has image: 1 - 0%
- has snowmobile=yes: 18 - 13%
- has water_source tag: 0 - 0%
- has wood_provided=yes: 0 - 0%

Wilderness huts details:
- has description tag: 18 - 41%
- has fireplace=yes: 41 - 95%
- has image: 5 - 11%
- has snowmobile=yes: 18 - 41%
- has water_source tag: 0 - 0%
- has wood_provided=yes: 0 - 0%

Alpine huts details:
- has description tag: 12 - 14%
- has fireplace=yes: 4 - 4%
- has image: 5 - 6%
- has snowmobile=yes: 19 - 23%
- has water_source tag: 2 - 2%
- has wood_provided=yes: 5 - 6%
電子郵件圖示 藍天圖示 Facebook 圖示 LinkedIn 圖示 乳齒象圖示 Telegram 圖示 X 圖示

討論

mmd2020年01月11日 21時12分 發表的評論

You can probably generate the same output with a single Overpass query without any external shell script. Check out osm.wiki/Overpass_API/Overpass_API_by_Example#Wiki_table_generator_.28since_0.7.54.29 for some ideas.

pangoSE2020年01月12日 13時34分 發表的評論

thanks for the tip!

pangoSE2020年01月12日 13時36分 發表的評論

@mmd can it also calculate the percentages?

登入 來留下評論