Skip to content

Instantly share code, notes, and snippets.

@nyampire
Last active October 1, 2023 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nyampire/af991b92252254822d752c34777374f6 to your computer and use it in GitHub Desktop.
Save nyampire/af991b92252254822d752c34777374f6 to your computer and use it in GitHub Desktop.
OSMの対象地域のユーザ一覧を抽出する:簡易版
# Geofabrikから、Chubu地域のpbf(ina.osm chubu-latest-internal.osm.pbf)をダウンロードする
# JOSMで伊那市のバウンダリをダウンロードして、ina.osmとして保存
# 伊那市の部分だけを抽出
osmium extract -p ina.osm chubu-latest-internal.osm.pbf -o ina2016.osm.pbf
# 2016年から、2022年4月4日までのデータを抽出して、"ina-new2016.osm"として保存
osmium time-filter ina2016.osm.pbf -f osm 2016-01-01T00:00:00Z 2022-04-01T00:00:00Z -o ina-new2016.osm
# buildingタグをもったウェイを抽出
osmium tags-filter ina-new2016.osm w/building -O -o ina-building-2016.osm
# ユーザID部分をcutで切り出して、uniqしてsortしてwc
grep "way id" ./ina-building-2016.osm | cut -f 10 -d "\"" | sort | uniq | wc -l
# ユーザIDと編集年を抽出してsortするバージョン
grep "way id" ./kitaku-building.osm | cut -f 6,10 -d "\"" | sed -e 's/-/"/g' | cut -f 1,4 -d "\"" | sed -e 's/"/ /g' | sort | uniq -c | sort -n -r | head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment