Relation Analyzer/Bookmarklet

From OpenStreetMap Wiki
Jump to: navigation, search

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);