Λογότυπο OpenStreetMap OpenStreetMap

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

Δημοσιεύτηκε από τον/την jaakkoh στις 30 Μάρτιος 2012 στα 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.

Εικονίδιο email Εικονίδιο Bluesky Εικονίδιο Facebook Εικονίδιο LinkedIn Εικονίδιο Mastodon Εικονίδιο Telegram Εικονίδιο X

Συζήτηση

Σχόλιο από τον/την goldfndr στις 6 Απρίλιος 2012 στις 06:08

By putting the a[4] into the parameter, you can handle Nodes/Ways/Relations with one bookmarklet: javascript:a=document.location.href.split('/'); if(a[2]+a[3]=='www.openstreetmap.orgbrowse') {document.location.href='http://osm.mapki.com/history/'+a[4]+'.php?id='+a[5]} else {alert('This is not a valid OSM node/way/relation info page.')}

Συνδεθείτε για να αφήσετε ένα σχόλιο