124 lines
2.8 KiB
HTML
124 lines
2.8 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<link rel="stylesheet" href="/leaflet/leaflet.css">
|
|
<script src="/leaflet/leaflet.js"></script>
|
|
<script src="/esri-leaflet/esri-leaflet.js"></script>
|
|
<style>
|
|
html,
|
|
body {
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
#map {
|
|
width: 800px;
|
|
height: 600px;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body class="">
|
|
<div id="map"></div>
|
|
<script>
|
|
function init() {
|
|
var params = {};
|
|
if (location.search) {
|
|
var parts = location.search.substring(1).split('&');
|
|
|
|
for (var i = 0; i < parts.length; i++) {
|
|
var nv = parts[i].split('=');
|
|
if (!nv[0]) continue;
|
|
params[nv[0]] = nv[1] || true;
|
|
}
|
|
}
|
|
|
|
var map = L.map('map', {
|
|
zoomControl: false,
|
|
attribution: '',
|
|
});
|
|
|
|
var tileLayer = L.esri.basemapLayer('Imagery').addTo(map);
|
|
L.esri.basemapLayer('ImageryLabels').addTo(map);
|
|
|
|
var mapDiv = document.getElementById("map");
|
|
mapDiv.style.width = params.width + 'px';
|
|
mapDiv.style.height = params.width + 'px';
|
|
map.invalidateSize();
|
|
|
|
map.setView([params.clat, params.clon], params.zoom);
|
|
|
|
/*
|
|
var sprayAreaColor = 'blue';
|
|
var strokeWidth = 4;
|
|
var excludedAreaColor = 'red';
|
|
|
|
if (req.job) {
|
|
var geojsonLayers = [];
|
|
if (req.job.sprayAreas) {
|
|
req.job.sprayAreas.forEach(function (area) {
|
|
area['type'] = 'Feature';
|
|
var layer = L.geoJSON(area, {
|
|
style: function (feature) {
|
|
return {
|
|
color: feature.properties['color'] || sprayAreaColor,
|
|
weight: strokeWidth
|
|
};
|
|
}
|
|
});
|
|
geojsonLayers.push(layer.getLayers()[0]);
|
|
});
|
|
}
|
|
|
|
if (req.job.excludedAreas) {
|
|
req.job.excludedAreas.forEach(function (area) {
|
|
area['type'] = 'Feature';
|
|
var layer = L.geoJSON(area, {
|
|
style: function (feature) {
|
|
return {
|
|
color: feature.properties['color'] || excludedAreaColor,
|
|
weight: strokeWidth
|
|
};
|
|
}
|
|
});
|
|
geojsonLayers.push(layer.getLayers()[0]);
|
|
});
|
|
}
|
|
|
|
var geojsonMarkerOptions = {
|
|
icon: L.icon({
|
|
iconUrl: 'marker-icon.png',
|
|
shadowUrl: 'marker-shadow.png',
|
|
iconAnchor: [12, 41]
|
|
})
|
|
};
|
|
|
|
if (req.job.waypoints) {
|
|
req.job.waypoints.forEach(function (point) {
|
|
point['type'] = 'Feature';
|
|
var layer = L.geoJSON(point, {
|
|
pointToLayer: function (feature, latlng) {
|
|
return new L.Marker(latlng, geojsonMarkerOptions);
|
|
}
|
|
});
|
|
geojsonLayers.push(layer.getLayers()[0]);
|
|
});
|
|
}
|
|
|
|
geojsonLayers.forEach(function (gsLayer) {
|
|
gsLayer.addTo(map);
|
|
});
|
|
}
|
|
*/
|
|
|
|
// map.setView(new L.latLng(params.clat, params.clon), params.zoom);
|
|
}
|
|
window.onload = init;
|
|
</script>
|
|
</body>
|
|
|
|
</html> |