OpenStreetMap logo OpenStreetMap

Your personal little tagwatch script

Posted by vibrog on 26 September 2008 in English.

curl -g "http://osmxapi.hypercube.telascience.org/api/0.5/*[https://wiki.openstreetmap.org/wiki/Tag:osm:user=$username]" \
| grep '<tag ' | sed -E "s/<tag k='(.*(name|ref)|note|ele|layer|is_in)' v=.*\/>/<tag k=\'\1\' v='*'\/>/" \
| sort | uniq -c

Example output (shortened):

 117     <tag https://wiki.openstreetmap.org/wiki/Tag:k='bicycle' https://wiki.openstreetmap.org/wiki/Tag:v='yes'/>

1075 <tag https://wiki.openstreetmap.org/wiki/Tag:k='highway' https://wiki.openstreetmap.org/wiki/Tag:v='footway'/>
489 <tag https://wiki.openstreetmap.org/wiki/Tag:k='highway' https://wiki.openstreetmap.org/wiki/Tag:v='track'/>
268 <tag https://wiki.openstreetmap.org/wiki/Tag:k='highway' https://wiki.openstreetmap.org/wiki/Tag:v='unclassified'/>
72 <tag https://wiki.openstreetmap.org/wiki/Tag:k='landuse' https://wiki.openstreetmap.org/wiki/Tag:v='farm'/>
284 <tag https://wiki.openstreetmap.org/wiki/Tag:k='marked_trail' https://wiki.openstreetmap.org/wiki/Tag:v='blue'/>
435 <tag https://wiki.openstreetmap.org/wiki/Tag:k='name' https://wiki.openstreetmap.org/wiki/Tag:v='*'/>
18 <tag https://wiki.openstreetmap.org/wiki/Tag:k='natural' https://wiki.openstreetmap.org/wiki/Tag:v='wood'/>
199 <tag https://wiki.openstreetmap.org/wiki/Tag:k='route' https://wiki.openstreetmap.org/wiki/Tag:v='ski'/>
118 <tag https://wiki.openstreetmap.org/wiki/Tag:k='source' https://wiki.openstreetmap.org/wiki/Tag:v='survey'/>
151 <tag https://wiki.openstreetmap.org/wiki/Tag:k='tracktype' https://wiki.openstreetmap.org/wiki/Tag:v='grade4'/>
9 <tag https://wiki.openstreetmap.org/wiki/Tag:k='trail_visibility' https://wiki.openstreetmap.org/wiki/Tag:v='intermediate'/>

Email icon Bluesky Icon Facebook Icon LinkedIn Icon Mastodon Icon Telegram Icon X Icon

Discussion

Comment from Heinz on 26 September 2008 at 22:18

Hi,
Can you please give an example of the output? On my box sed doesn't have an -E option and complains.
Please explain what the script should do. Thanks
Heinz

Comment from vibrog on 26 September 2008 at 23:36

-E is for extended regexp, e.g. used for the grouping, and inserting a group in the output using \1.

Comment from Heinz on 27 September 2008 at 10:13

That explains it, thanks.
Using -r or --regexp-extended works now in my "GNU sed Version 4.1.5"
and shows interesting results.
Heinz

Comment from vibrog on 27 September 2008 at 12:06

I'm glad you find it useful.
A further pipe through `sort -nr` will sort tags by frequency.

Log in to leave a comment