-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
81 lines (68 loc) · 2.97 KB
/
demo.html
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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=no">
<title>leaflet-ogcapi-features demo</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
</head>
<body style="margin: 0">
<div id="map" style="height: 100vh"></div>
<script type="module">
import {Collections} from "./src/Collections.js"
var map = L.map('map').setView([0,0], 2);
let osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
let baseMaps = {
"OpenStreetMap": osm,
};
let overlayMaps = {};
let layerControl = L.control.layers(baseMaps, overlayMaps).addTo(map);
// mapserver.org
let collections= new Collections(
"https://demo.mapserver.org/cgi-bin/mapserv/localdemo/ogcapi",
{
attribution: "<a href='https://demo.mapserver.org/' rel='noopener noreferrer' target='_blank'>Mapserver Demo</a>",
onEachFeature: (feature, layer) => {
layer.bindPopup(() => feature.properties.name);
},
}
);
collections.addTo(map);
// geoserver
let geoserver_collections = new Collections(
"https://geonovum.geosolutionsgroup.com/geoserver/ogc/features/v1",
{
attribution: "<a href='https://geonovum.geosolutionsgroup.com/geoserver/ogc/features/v1/' rel='noopener noreferrer' target='_blank'>GeoServer Sample INSPIRE Feature Service</a>",
onEachFeature: (feature, layer) => {
layer.bindPopup(() => "" + feature.properties.locator_designator_addressNumber + (feature.properties.locator_designator_addressNumberExtension || ""));
},
}
);
geoserver_collections.addTo(map);
// pygeoapi
let pygeoapi_collections = new Collections(
"https://demo.pygeoapi.io/stable",
{
attribution: "<a href='https://demo.pygeoapi.io/stable' rel='noopener noreferrer' target='_blank'>pygeoapi Demo instance</a> (<a href='https://creativecommons.org/licenses/by/4.0/' rel='noopener noreferrer' target='_blank'>CC-BY 4.0 license</a>)",
pagination_limit: 100,
feature_limit: 500,
onEachFeature: (feature, layer) => {
layer.bindPopup(() => JSON.stringify(feature.properties, null, 1));
},
}
);
pygeoapi_collections.addTo(map);
document.addEventListener("lc:new-layer", function(event) {
let layer = event.detail;
layerControl.addOverlay(layer, layer.options.metadata.title);
});
</script>
</body>
</html>