OpenStreetMap

jaakkoh's diary

Recent diary entries

JavaScript Bookmarklets for viewing OSM object's (node or way) deep history

Posted by jaakkoh on 30 March 2012 in English (English)

Continuing from my last (and also the first) note I ran into the OSM Deep History Service (osm.mapki.com/history) in the #OSM IRC channel. I've bumped into this some time before but because there's no convenient way to view the Deep History page of an object (i.e. keyboard short cut from JOSM or bookmarklet or Greasmonkey script) I thought I'd give it a try and see if my "magical" JavaScript skills (i.e. copy-paste from someone else's work) would tame this problem.

Short story short, after less than 5 minutes I had "created" bookmarklets that take you from the OSM.org/browse (object history) page for ways or nodes to the Mapki Deep History matrix of that object.

So, here they are (as text, my tech(?) skills weren't good enough to embed the links here):

  • OSM Mapki Way's Deep History Bookmarklet: javascript:a=document.location.href.split('/');if(a[2]+a[3]+a[4]=='www.openstreetmap.orgbrowseway'){document.location.href=' http://osm.mapki.com/history/way.php?id='+a[5]}else{alert('This is not a valid OSM way info page.') }

  • OSM Mapki Node's Deep History Bookmarklet: javascript:a=document.location.href.split('/');if(a[2]+a[3]+a[4]=='www.openstreetmap.orgbrowsenode){document.location.href=' http://osm.mapki.com/history/node.php?id='+a[5]}else{alert('This is not a valid OSM node info page.') }

Enjoy!

EDIT: Instructions on how to add code to the OSM User Diary check out http://daringfireball.net/projects/markdown/syntax#code . In essence you need to "wrap it with (double) backtick quotes (`)", as ToeBee kindly advice me on #OSM IRC.

JavaScript Bookmarklets for viewing mappers contributions

Posted by jaakkoh on 28 March 2012 in English (English)

I'm no developer, coder or even a proper geek. My experience in even HTML is quite limited or at least from about 10 years ago.

Anyways, I got a itch to try out if I could create (based on someone else's work) bookmarklets that would make it possible to jump from a mapper's user page to his/her "Your OSM Heat Map" and "How Did You Contribute to OSM" pages.

So, inspired by the fantastic OSM History Viewer and its bookmarklet I rolled up my sleeves. With a few copy-replace-by-pastes I got the bookmarklets. I'm pasting them here below as plain text (as I don't know how this system handles embedding(?) JavaScript links (and I don't have time to test that now):

(1) Your OSM Heat Map Bookmarklet: javascript:a=document.location.href.split('/');if(a[2]+a[3]=='www.openstreetmap.orguser'){document.location.href=' http://yosmhm.neis-one.org/?'+a[4]}else{alert('This is not a valid OSM user page.') }

(2) How Did You Contribute to OSM Bookmarklet: javascript:a=document.location.href.split('/');if(a[2]+a[3]=='www.openstreetmap.orguser'){document.location.href=' http://hdyc.neis-one.org/?'+a[4]}else{alert('This is not a valid OSM user page.') }

Once you've saved these bookmarklets you can get to the respective service pages (YOSMHM or HDYC) by going to a given mapper's user page and then clicking on the bookmarklet.

Cheers, -Jaakko

EDIT: Instructions on how to add code to the OSM User Diary check out http://daringfireball.net/projects/markdown/syntax#code . In essence you need to "wrap it with (double) backtick quotes (`)", as ToeBee kindly advice me on #OSM IRC.

Location: 7e Bellevue Chardonnières, Commune Pétion-Ville, Port-au-Prince, Département de l'Ouest, Haiti
Older Entries | Newer Entries