mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-06-28 06:12:08 +02:00
Added first version of the web server to drive the online mapping.
This commit is contained in:
106
cmd/mtwebmapper/web/index.html
Normal file
106
cmd/mtwebmapper/web/index.html
Normal file
@ -0,0 +1,106 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Minetest demo map</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="css/leaflet.css" />
|
||||
<link rel="stylesheet" href="css/Leaflet.Coordinates-0.1.4.css" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#map {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #111111;
|
||||
}
|
||||
|
||||
.leaflet-container {
|
||||
cursor: crosshair;
|
||||
}
|
||||
|
||||
.leaflet-control-coordinates,
|
||||
.leaflet-control-layers {
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.3);
|
||||
background-color:rgba(255,255,255,.85);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map"></div>
|
||||
<script src="js/leaflet.js"></script>
|
||||
<script src="js/Leaflet.Coordinates-0.1.4.min.js"></script>
|
||||
<script>
|
||||
|
||||
L.Projection.NoWrap = {
|
||||
project: function (latlng) {
|
||||
return new L.Point(latlng.lat, latlng.lng);
|
||||
},
|
||||
|
||||
unproject: function (point, unbounded) {
|
||||
return new L.LatLng(point.x, point.y, true);
|
||||
}
|
||||
};
|
||||
|
||||
L.CRS.Direct = L.Util.extend({}, L.CRS, {
|
||||
code: 'Direct',
|
||||
projection: L.Projection.NoWrap,
|
||||
transformation: new L.Transformation(1.0/65536, 30928.0/65536, -1.0/65536, 34608.0/65536)
|
||||
});
|
||||
|
||||
var world = new L.tileLayer('map/{z}/{x}/{y}.png', {
|
||||
minZoom: 0,
|
||||
maxZoom: 16,
|
||||
attribution: 'Demo world',
|
||||
continuousWorld: false,
|
||||
noWrap: true,
|
||||
//zoomReverse: true,
|
||||
tms: true
|
||||
});
|
||||
|
||||
var rasterMaps = {
|
||||
"A demo world": world,
|
||||
};
|
||||
|
||||
var latest = world
|
||||
|
||||
// Add popups to geojson features.
|
||||
function addPopupToFeature(feature, latest) {
|
||||
if (feature.properties && feature.properties.popupContent) {
|
||||
var divNode = document.createElement('DIV');
|
||||
divNode.innerHTML = feature.properties.popupContent;
|
||||
latest.bindPopup(divNode);
|
||||
}
|
||||
}
|
||||
|
||||
var overlayMaps = {};
|
||||
|
||||
var map = L.map('map', {
|
||||
center: [0,0],
|
||||
zoom: 3,
|
||||
layers: [latest],
|
||||
worldCopyJump: false,
|
||||
crs: L.CRS.Direct});
|
||||
|
||||
L.control.coordinates({
|
||||
position:"topright", //optional default "bootomright"
|
||||
decimals:0, //optional default 4
|
||||
decimalSeperator:".", //optional default "."
|
||||
labelTemplateLat:"X: {y}", //optional default "Lat: {y}"
|
||||
labelTemplateLng:"Y: {x}", //optional default "Lng: {x}"
|
||||
enableUserInput:false, //optional default true
|
||||
useDMS:false, //optional default false
|
||||
useLatLngOrder: true //ordering of labels, default false-> lng-lat
|
||||
}).addTo(map);
|
||||
|
||||
var layersControl = new L.Control.Layers(rasterMaps, overlayMaps, {collapsed: false});
|
||||
map.addControl(layersControl);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user