source: src/webapp/webserver/js/GnuBoat.Webserver.js@ 26d66d8

debian/bullseye
Last change on this file since 26d66d8 was 883b4a5, checked in by Joachim Langenbach <joachim.langenbach@…>, 8 years ago

Added GNUBoat tiles to leaflet map

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2
3 Copyright (C) 2018 - 2019 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 MA 02110-1301 USA.
19
20*/
21
22/** @namespace GnuBoat JavaScript namespace */
23var GnuBoat = GnuBoat || {};
24/** @namespace GnuBoat Webserver JavaScript namespace */
25GnuBoat.Webserver = GnuBoat.Webserver || {};
26
27GnuBoat.Webserver.initialize = function()
28{
29 GnuBoat.Webserver.private.mapSetup();
30}
31
32GnuBoat.Webserver.private = {
33 map: null,
34 mapSetup: function ()
35 {
36 GnuBoat.Webserver.private.map = L.map('mapViewport').setView([48.43, 10.04], 17);
37
38 var layer_openstreetmap = L.tileLayer(
39 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
40 { attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}
41 ).addTo(GnuBoat.Webserver.private.map);
42 var layer_openseamap = L.tileLayer(
43 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png',
44 {attribute: '&copy; <a href="http://www.openseamap.org">OpenSeaMap</a> contributors'}
45 ).addTo(GnuBoat.Webserver.private.map);
46
47 // add GNUBoat layers
48 var layer_gnuboat_hillshade = L.tileLayer(
49 './tiles/hillshade/{z}/{x}/{y}.png',
50 {tms: true, opacity: 0.2, zIndex: 98, attribute: '&copy; <a href="http://gnuboat.engsas.de">GNUBoat</a> contributors'}
51 );
52 var layer_gnuboat_color_relief= L.tileLayer(
53 'tiles/color_relief/{z}/{x}/{y}.png',
54 {tms: true, opacity: 0.4, zIndex: 99, attribute: '&copy; <a href="http://gnuboat.engsas.de">GNUBoat</a> contributors'}
55 );
56 var layer_gnuboat_slopeshade = L.tileLayer(
57 'tiles/slopeshade/{z}/{x}/{y}.png',
58 {tms: true, opacity: 0.2, zIndex: 97, attribute: '&copy; <a href="http://gnuboat.engsas.de">GNUBoat</a> contributors'}
59 );
60 var layer_gnuboat_group = L.layerGroup([layer_gnuboat_color_relief, layer_gnuboat_hillshade, layer_gnuboat_slopeshade]).addTo(GnuBoat.Webserver.private.map);
61
62 // add layer control
63 var baselayers = {
64 "Map": layer_openstreetmap,
65 };
66 // overlays
67 var overlays = {"Seamarks": layer_openseamap,
68 "GNUBoat": layer_gnuboat_group,
69// "GNUBoat Hillshade": layer_gnuboat_hillshade,
70// "GNUBoat Color Relief": layer_gnuboat_color_relief,
71// "GNUBoat Slopeshade": layer_gnuboat_slopeshade,
72 };
73 GnuBoat.Webserver.private.mapControl = L.control.layers(
74 baselayers, overlays,
75 {hideSingleBase: true, sortLayers: true, }
76 ).addTo(GnuBoat.Webserver.private.map);
77
78 // add scale
79 L.control.scale().addTo(GnuBoat.Webserver.private.map);
80 }
81}
Note: See TracBrowser for help on using the repository browser.