forked from MediaComem/geocity-wc-map
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
146 lines (143 loc) · 5.61 KB
/
index.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Geocity</title>
<link rel="stylesheet" href="./src/styles/index.css" />
<script type="module" src="/src/openlayers-element.ts"></script>
</head>
<body>
<h1>Other demo list</h1>
<ul>
<li>
<a href="demo/harassment-alert-create.html">harassment-alert-create</a>
</li>
<li>
<a href="demo/harassment-alert-create-with-border.html">harassment-alert-create-with-border</a>
</li>
<li>
<a href="demo/harassment-alert-multiple-create.html">harassment-alert-multiple-create</a>
</li>
<li>
<a href="demo/harassment-alert-target.html">harassment-alert-target</a>
</li>
<li>
<a href="demo/inclusion-area-target.html">inclusion-area-target</a>
</li>
<li>
<a href="demo/inclusion-area-target-with-strong-constraint.html">inclusion-area-target-with-strong-constraint</a>
</li>
<li>
<a href="demo/street-lamp-multiple-select.html">street-lamp-multiple-select</a>
</li>
<li>
<a href="demo/street-lamp-select.html">street-lamp-select</a>
</li>
</ul>
<h1>Exemple</h1>
<div style="width: 100%; height: 80vh;margin-left: auto;margin-right: auto">
<openlayers-element options='{
"information": { "duration": 5000, "title": "Signaler un banc cassé", "content": "Positionner le centre de la cible à l’emplacement du banc cassé dans l’espace public" },
"interaction": {
"displayZoom": true,
"displayScaleLine": false,
"fullscreen": true,
"enableGeolocation": true,
"enableCenterButton": true,
"enableRotation": true
},
"mode": {
"type": "mix"
},
"geolocationInformation": {
"displayBox": true,
"reverseLocation": true,
"currentLocation": false
},
"notifications": [
{
"type": "warning",
"message": "Veuillez zoomer davantage avant de pouvoir sélectionner un emplacement.",
"rule": {
"type": "ZOOM_CONSTRAINT",
"minZoom": 16
}
},
{
"type": "warning",
"message": "Le maximum de sélections est limité à {x}.",
"rule": {
"type": "MAX_SELECTION",
"maxElement": 4
}
},
{
"type": "info",
"message": "Déplacez la carte pour que l’endroit désiré soit au centre de la cible.",
"rule": {
"type": "MOVE_TARGET"
}
}
],
"border": {
"url": "http://localhost:5173/border.json",
"notification": "Veuillez placer votre élément dans les limites autorisées"
},
"wfs": {
"url": "https://mapnv.ch/mapserv_proxy?ogcserver=source+for+image%2Fpng&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=ELE_tragwerk_gesco"
},
"wmts": [{
"capability": "https://wmts.asit-asso.ch/wmts?&Service=WMTS&Version=1.0.0&Request=GetCapabilities",
"layer": "asitvd.fond_cadastral",
"projection": "EPSG:2056",
"name": "Carte de base",
"thumbnail": ""
},
{
"capability": "https://wmts.geo.admin.ch/EPSG/2056/1.0.0/WMTSCapabilities.xml",
"layer": "ch.swisstopo.swissimage",
"projection": "EPSG:2056",
"name": "Photo aérienne",
"thumbnail": "http://localhost:5173/aerial.svg"
}],
"inclusionArea": {
"url": "https://mapnv.ch/mapserv_proxy?ogcserver=source+for+image%2Fpng&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&typeName=MO_bf_bien_fonds",
"filter": "GeometryOperands=urn:ogc:def:crs:EPSG::2056&FILTER=<Filter><And><PropertyIsEqualTo><ValueReference>commune</ValueReference><Literal>Yverdon-les-Bains</Literal></PropertyIsEqualTo><PropertyIsNotEqualTo><ValueReference>genre</ValueReference><Literal>Parcelle privée</Literal></PropertyIsNotEqualTo><BBOX></And></Filter>"
},
"selectionTargetBoxMessage": "Emplacement du banc",
"outputFormat": "GeometryCollection"
}' states='{
"readonly": false,
"currentSelections": [[2539063.19,1181419.5], [2539064.6,1181401.67]]
}'
/>
</div>
<div style="width: 100%; display: flex; margin-top: 1vh">
<button id="validate" style="margin-left: auto;margin-right: auto; width: 229px; height: 36px; background-color: #008C6F; border: 10px solid #008C6F ;color: white">Valider</button>
</div>
<div style="width: 100%; display: flex; margin-top: 1vh; justify-content: center;">
<span id="coordinate"></span>
</div>
</body>
<script>
const toSendEvent = '';
const button = document.getElementById('validate');
button.disabled = true;
button.style.opacity = 0.5;
button.addEventListener('click', () => {
document.getElementById('coordinate').innerHTML = JSON.stringify(this.toSendEvent);
})
window.addEventListener('position-selected', (event) => {
const button = document.getElementById('validate');
if (event.detail) {
button.disabled = false;
button.style.opacity = 1;
this.toSendEvent = event.detail;
} else {
button.disabled = true;
button.style.opacity = 0.5;
}
})
</script>
</html>