Skip to content

Instantly share code, notes, and snippets.

@zhm
Created June 25, 2012 02:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhm/2986044 to your computer and use it in GitHub Desktop.
Save zhm/2986044 to your computer and use it in GitHub Desktop.
osmstats
OSMUSER="coleman"; curl -s "www.overpass-api.de/api/interpreter?data=%5Bout%3Ajson%5D%3B%28node%28user%3A%22$OSMUSER%22%29%3Bway%28user%3A%22$OSMUSER%22%29%3Brelation%28user%3A%22$OSMUSER%22%29%3B%29%3Bout%3B" | ruby -e "require 'json'; osm = JSON.parse(STDIN.read); nodes = osm['elements'].select {|e| e['type'] == 'node'}; ways = osm['elements'].select {|e| e['type'] == 'way'}; relations = osm['elements'].select {|e| e['type'] == 'relation'}; puts ''; puts 'stats for $OSMUSER:'; puts 'nodes: ' + nodes.count.to_s; puts 'ways: ' + ways.count.to_s; puts 'relations: ' + relations.count.to_s; puts ''"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment