OpenDroneMap-WebODM/plugins/osm-quickedit/public/main.js

33 wiersze
1.2 KiB
JavaScript

PluginsAPI.Map.addActionButton(function(options){
if (options.tiles.length > 0){
// TODO: pick the topmost layer instead
// of the first on the list, to support
// maps that display multiple tasks.
var tile = options.tiles[0];
var url = window.location.protocol + "//" +
window.location.host +
tile.url.replace(/tiles\.json$/, "tiles/{zoom}/{x}/{ty}.png");
return React.createElement("button", {
type: "button",
className: "btn btn-sm btn-secondary",
onClick: function(){
var mapLocation = options.map.getZoom() + "/" +
options.map.getCenter().lat + "/" +
options.map.getCenter().lng;
if (window.prompt("To start digitizing this map on OpenStreetMap:\n\n" +
"1. Copy the URL below.\n" +
"2.When the editor loads, open the Background Settings (press B) and select \"Custom\".\n" +
"3. Press \"Edit Custom Background\".\n" +
"4. Paste the URL you copied below.\n\n" +
"Press OK to go to OpenStreetMap", url)){
window.location.href = "https://www.openstreetmap.org/edit?editor=id#map=" + mapLocation;
}
}
}, React.createElement("i", {className: "fa fa-map"}, ""),
" OSM Digitize");
}
});