1
0
forked from MTSR/mapserver
mapserver/server/static/js/main.js

52 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-01-20 21:50:24 +03:00
(function(){
2019-01-29 20:08:54 +03:00
'use strict';
2019-01-20 21:50:24 +03:00
2019-01-29 23:07:29 +03:00
api.getConfig().then(function(cfg){
LayerManager.init(cfg.layers);
});
2019-01-20 21:50:24 +03:00
var crs = L.Util.extend({}, L.CRS.Simple, {
//transformation: L.transformation(0.001, 0, -0.001, 0),
scale: function (zoom) {
return Math.pow(2, zoom-9);
}
});
var initialZoom = 11;
var initialCenter = [0, 0];
var map = L.map('image-map', {
minZoom: 2,
maxZoom: 12,
center: initialCenter,
zoom: initialZoom,
crs: crs
});
2019-01-29 10:57:35 +03:00
WebSocketChannel.connect();
2019-01-22 22:19:04 +03:00
2019-01-29 20:00:00 +03:00
map.attributionControl.addAttribution('<a href="https://github.com/thomasrudin-mt/mapserver">Mapserver</a>');
2019-01-20 21:50:24 +03:00
var layers = {};
2019-01-29 20:08:54 +03:00
var overlays = {}
RealtimeTileLayer.init();
2019-01-20 21:50:24 +03:00
2019-01-29 10:57:35 +03:00
var Layer = RealtimeTileLayer.create(0);
2019-01-20 21:50:24 +03:00
var tileLayer = new Layer();
tileLayer.addTo(map);
2019-01-29 20:08:54 +03:00
layers["Base"] = tileLayer;
overlays["Travelnet"] = new TravelnetOverlay();
L.control.layers(layers, overlays).addTo(map);
2019-01-20 21:50:24 +03:00
2019-01-29 10:57:35 +03:00
var el = CoordinatesDisplay.create({ position: 'bottomleft' });
2019-01-20 21:50:24 +03:00
el.addTo(map);
})()