Relation Analyzer/Bookmarklet

From OpenStreetMap Wiki
Jump to navigation Jump to search

From OSM.org

An unofficial bookmarklet (see this page's history for authors) tested only with Firefox (edit this if you tested in another browser).

Run this on a page (/history page works too) of a relationexample page. The bookmarklet opens the RA in a new tab.

javascript:var urlParts=document.location.href.split('/'); if(urlParts[2]==='www.openstreetmap.org') { if (urlParts[3]==="relation") { var idMatch = urlParts[4].match(/\d+/); var objId = idMatch[0]; window.open('http://ra.osmsurround.org/analyzeRelation?relationId=' + objId); } else { alert('Only relations can be analysed.'); } } else { alert('This is not a supported www.openstreetmap.org page.'); } void(0);

Version without spaces:

javascript:var%20urlParts=document.location.href.split('/');if(urlParts[2]==='www.openstreetmap.org'){if(urlParts[3]==="relation"){var%20idMatch=urlParts[4].match(/\d+/);var%20objId=idMatch[0];window.open('http://ra.osmsurround.org/analyzeRelation?relationId='+objId);}else{alert('Only%20relations%20can%20be%20analysed.');}}else{alert('This%20is%20not%20a%20supported%20www.openstreetmap.org%20page.');}void(0);

From Waymarked Trails

Note the analyzer does not support nested relations ie. it cannot analyze a superroute or route containing other relations.

javascript:(function(){id=location.href.match(/waymarkedtrails\.org\/\#route\?id=(\d+)/);if(id!=null){window.open('http://ra.osmsurround.org/analyzeRelation?relationId='+id[1]);}else{alert('This is not a valid Waymarked Trails relation page.')}})()