Bash/Script to know your favorite tags

From OpenStreetMap Wiki
Jump to navigation Jump to search

If you want to know which the tags of the features you frequently edit, you can run the following Linux bash script as a start. It will tell the frequency of key=tag pairs in all your edit history:

  # source:
  # To use this: change the $osm_user strings in this file by an OSM user name (hard coded) or change the following line:
  # Might not work with strange characters in name ( !i! ?)
  wget -q -O -$osm_user | sed -e 's_.*changeset id="\([0-9]\+\)".*_\1_' | grep -v "<" > my_changesets.txt
  echo "Processing changeset:"
  while read changeset_id
  echo $changeset_id
  wget  -q -O -$changeset_id/download | grep "<tag k" | sed -e 's/ \+<tag k="//g' | sed  -e 's/" v="/=/' | sed -e 's_"/>__' >> tmp_$osm_user.txt
  done < my_changesets.txt
  sort tmp_$osm_user.txt | uniq -c | sort -b -n -r > favorite_tags_$osm_user.txt