-
Notifications
You must be signed in to change notification settings - Fork 2
/
003script.js
81 lines (65 loc) · 2.14 KB
/
003script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
const initialZoom = 13
const latitude = 58.15
const longitude = 8
var map = L.map("map").setView([latitude, longitude], initialZoom);
// OsmTileLayer
const openStreetMapTileLayerLink = "https://tile.openstreetmap.org/{z}/{x}/{y}.png";
const openStreetMapAttribution = '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors';
// OtmTileLayer
const openTopoMapLayerLink = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png";
const openTopoMapMaxZoom = 17;
const openTopoMapAttribution = 'Map data: © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: © <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)';
// Norkart
const apiKey = "" // User your own key from https://developer.norkart.no/
/**************************
* Defining the map Layers *
**************************/
var openStreetMap = L.tileLayer(openStreetMapTileLayerLink,
{
attribution: openStreetMapAttribution,
}
);
var openTopoMap = L.tileLayer(openTopoMapLayerLink,
{
maxZoom: openTopoMapMaxZoom,
attribution: openTopoMapAttribution,
}
);
var norkartLite = L.tileLayer.webatlas(
{
mapType: L.TileLayer.Webatlas.Type.LITE,
apikey: apiKey,
}
);
var norkartHybrid = L.tileLayer.webatlas(
{
mapType: L.TileLayer.Webatlas.Type.HYBRID,
apikey: apiKey,
}
);
var norkartAerial = L.tileLayer.webatlas(
{
mapType: L.TileLayer.Webatlas.Type.AERIAL,
apikey: apiKey,
}
);
/** All available Norkart map types
L.TileLayer.Webatlas.Type.GREY
L.TileLayer.Webatlas.Type.VECTOR
L.TileLayer.Webatlas.Type.MEDIUM
L.TileLayer.Webatlas.Type.LITE
L.TileLayer.Webatlas.Type.AERIAL
L.TileLayer.Webatlas.Type.HYBRID
*/
/***************************************
* Setting up the map and adding layers *
***************************************/
norkartAerial.addTo(map);
var baseLayers = {
OpenStreetMap: openStreetMap,
Topo: openTopoMap,
NorkartLite: norkartLite,
NorkartHybrid: norkartHybrid,
NorkartAerial: norkartAerial,
};
L.control.layers(baseLayers).addTo(map);