-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrendu.html
521 lines (416 loc) · 18.2 KB
/
rendu.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.2/leaflet.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.2/leaflet.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yohanboniface/Leaflet.EditInOSM@d529b0a43b1476db0b13cad3a15593f83fd056c4/Leaflet.EditInOSM.css" />
<script src="https://cdn.jsdelivr.net/gh/yohanboniface/Leaflet.EditInOSM@d529b0a43b1476db0b13cad3a15593f83fd056c4/Leaflet.EditInOSM.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-hash/0.2.1/leaflet-hash.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/ardhi/Leaflet.MousePosition@c32f1c84ec49dbf7ad599c51c8659d5e08af0f97/src/L.Control.MousePosition.js"></script>
<script src="https://cdn.jsdelivr.net/gh/sidjy/leaflet-ugeojson@2b3044d2d3df17d99672f6fe5211109adc50a0a4/src/leaflet.uGeoJSON.js"></script>
<script src="https://unpkg.com/leaflet.vectorgrid@latest/dist/Leaflet.VectorGrid.bundled.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/komoot/leaflet.photon@86cc8a36129c5de58c0cebd7834d0bbcaa37af93/leaflet.photon.css" />
<script src="https://cdn.jsdelivr.net/gh/komoot/leaflet.photon@86cc8a36129c5de58c0cebd7834d0bbcaa37af93/leaflet.photon.js"></script>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src='https://api.mapbox.com/mapbox.js/plugins/leaflet-locatecontrol/v0.43.0/L.Control.Locate.min.js'></script>
<link href='https://api.mapbox.com/mapbox.js/plugins/leaflet-locatecontrol/v0.43.0/L.Control.Locate.mapbox.css' rel='stylesheet' />
<!--[if lt IE 9]>
<link href='https://api.mapbox.com/mapbox.js/plugins/leaflet-locatecontrol/v0.43.0/L.Control.Locate.ie.css' rel='stylesheet' />
<![endif]-->
<link href='https://api.mapbox.com/mapbox.js/plugins/leaflet-locatecontrol/v0.43.0/css/font-awesome.min.css' rel='stylesheet' />
<link rel="stylesheet" href="https://sidjy.github.io/lib/OverPassLayer.css" />
<script src="https://sidjy.github.io/lib/OverPassLayer.js"></script>
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
.photon-autocomplete li .type {
font-family: 'open_sanslight';
font-weight: normal;
float: right;
font-size: 0.8em;
}
</style>
</head>
<body>
<div id='map'></div>
<script type='text/javascript'>
var mapillary = new L.vectorGrid.protobuf("https://d25uarhxywzl1j.cloudfront.net/v0.1/{z}/{x}/{y}.mvt", {
maxNativeZoom: 14,
maxZoom: 20,
});
function $_GET(param) {
var vars = {};
window.location.href.replace( location.hash, '' ).replace(
/[?&]+([^=&]+)=?([^&]*)?/gi, // regexp
function( m, key, value ) { // callback
vars[key] = value !== undefined ? value : '';
}
);
if ( param ) {
return vars[param] ? vars[param] : null;
}
return vars;
}
var APE_param = $_GET('ape');
var geojsonMarkerOptionsSIRENE = {
radius: 8,
fillColor: "#ff7800",
color: "#000",
weight: 1,
opacity: 1,
fillOpacity: 0.8
};
function onEachFeatureSIRENE(feature, layer) {
// does this feature have a property named popupContent?
//if (feature.properties && feature.properties.popupContent) {
layer.bindPopup("<p>"+feature.properties.l1_normalisee
+"("+feature.properties.l2_normalisee+" - "+feature.properties.siret+")</p><p>"
+feature.properties.l3_normalisee+"</p><p>"
+feature.properties.l4_normalisee+"</p><p>"
+feature.properties.libapen+"</p><p>"
+feature.properties.libtefen+"</p><p>"
);
//}
}
// couche "osmfr"
var osmfr = L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {
attribution: 'données © <a href="http://osm.org/copyright">OpenStreetMap</a>/ODbL - rendu cquest',
minZoom: 1,
maxZoom: 20
});
var hot = L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
attribution: 'données © <a href="http://osm.org/copyright">OpenStreetMap</a>/ODbL - rendu ybon',
minZoom: 1,
maxZoom: 20
});
var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Tuiles OSM - données © <a href="http://osm.org/copyright">OpenStreetMap</a>/ODbL',
minZoom: 1,
maxZoom: 20
});
var carto = L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_nolabels/{z}/{x}/{y}.png', {
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="https://carto.com/attributions">CARTO</a>'
});
//var mapquest = L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png', {
// attribution: 'Tuiles <a href="http://www.mapquest.com/" target="_blank">© MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png"> - données © <a href="http://osm.org/copyright">OpenStreetMap</a>/ODbL',
// minZoom: 1,
// maxZoom: 20
// });
//var ortho = L.tileLayer('http://proxy-ign.openstreetmap.fr/bdortho/{z}/{x}/{y}.jpg', {
// attribution: 'Tuiles <a href="http://openstreetmap.fr/bdortho" target="_blank">© IGN</a>',
// minZoom: 6,
// maxZoom: 19
// });
var landscape = L.tileLayer('http://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png', {
attribution: 'Tuiles <a href="http://www.thunderforest.com/landscape/" target="_blank">© Gravitystorm Limited</a> - données © <a href="http://osm.org/copyright">OpenStreetMap</a>/ODbL',
minZoom: 1,
maxZoom: 18
});
var transport = L.tileLayer('http://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png', {
attribution: 'Tuiles <a href="http://www.thunderforest.com/transport/" target="_blank">© Gravitystorm Limited</a> - données © <a href="http://osm.org/copyright">OpenStreetMap</a>/ODbL',
minZoom: 1,
maxZoom: 18
});
//var cycle = L.tileLayer('http://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png', {
// attribution: 'Tuiles <a href="http://www.thunderforest.com/cycle/" target="_blank">© Gravitystorm Limited</a> - données © <a href="http://osm.org/copyright">OpenStreetMap</a>/ODbL',
// minZoom: 1,
// maxZoom: 18
// });
var outdoors = L.tileLayer('http://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png', {
attribution: 'Tuiles <a href="http://www.thunderforest.com/outdoors/" target="_blank">© Gravitystorm Limited</a> - données © <a href="http://osm.org/copyright">OpenStreetMap</a>/ODbL',
minZoom: 1,
maxZoom: 18
});
var river = L.tileLayer( 'https://{s}.tile.openstreetmap.fr/openriverboatmap/{z}/{x}/{y}.png', {
attribution: 'Calque © ybon - - données © <a href="http://osm.org/copyright">OpenStreetMap</a>/ODbL',
minZoom: 1,
maxZoom: 20
});
var bw = L.tileLayer('http://www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png', {
attribution: 'données © <a href="http://osm.org/copyright">OpenStreetMap</a>/ODbL',
minZoom: 1,
maxZoom: 20
});
var route500 = L.tileLayer('https://{s}.tile.openstreetmap.fr/route500/{z}/{x}/{y}.png', {
attribution: 'Route500 © IGN - LO/OL',
minZoom: 1,
maxZoom: 20
});
var carthage = L.tileLayer('https://{s}.tile.openstreetmap.fr/route500hydro/{z}/{x}/{y}.png', {
attribution: 'BD Carthage (IGN/ONEMA) - LO/OL',
minZoom: 1,
maxZoom: 20
});
var sea = L.tileLayer( 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', {
attribution: '<a href="http://osm.org/copyright">OpenStreetMap</a>/ODbL',
minZoom: 1,
maxZoom: 20
});
var relief = L.tileLayer('http://tiles2.openpistemap.org/landshaded/{z}/{x}/{y}.png', {
attribution: 'Relief openpistemap (source NASA SRTMv3 + ASTER)',
minZoom: 1,
maxZoom: 16
});
var fradm = L.tileLayer('https://{s}.tile.openstreetmap.fr/fradm/{z}/{x}/{y}.png', {
attribution: 'FR-ADM © <a href="http://wiki.openstreetmap.org/wiki/FR:Servers/tile.openstreetmap.fr">OSM-FR/cquest</a>',
minZoom: 1,
maxZoom: 20
});
var volta = L.tileLayer('https://{s}.tile.openstreetmap.fr/volta/{z}/{x}/{y}.png', {
attribution: '© <a href="http://wiki.openstreetmap.org/wiki/FR:Servers/tile.openstreetmap.fr">OSM-FR/cquest</a>',
minZoom: 5,
maxZoom: 21,
});
var bdtopo = L.tileLayer('https://{s}.tile.openstreetmap.fr/bdtopo/{z}/{x}/{y}.png', {
attribution: 'BD Topo IGN © <a href="http://wiki.openstreetmap.org/wiki/FR:Servers/tile.openstreetmap.fr">OSM-FR/cquest</a>',
minZoom: 5,
maxZoom: 21,
});
var adm4 = L.tileLayer('https://{s}.layers.openstreetmap.fr/admin4/{z}/{x}/{y}.png', {
attribution: 'FR-ADM © <a href="http://wiki.openstreetmap.org/wiki/FR:Servers/tile.openstreetmap.fr">OSM-FR/cquest</a>',
minZoom: 5,
maxZoom: 20
});
var adm6 = L.tileLayer('http://{s}.layers.openstreetmap.fr/admin6/{z}/{x}/{y}.png', {
attribution: 'FR-ADM © <a href="http://wiki.openstreetmap.org/wiki/FR:Servers/tile.openstreetmap.fr">OSM-FR/cquest</a>',
minZoom: 5,
maxZoom: 20
});
var adm7 = L.tileLayer('http://{s}.layers.openstreetmap.fr/admin7/{z}/{x}/{y}.png', {
attribution: 'FR-ADM © <a href="http://wiki.openstreetmap.org/wiki/FR:Servers/tile.openstreetmap.fr">OSM-FR/cquest</a>',
minZoom: 6,
maxZoom: 20
});
var adm8 = L.tileLayer('http://{s}.layers.openstreetmap.fr/admin8/{z}/{x}/{y}.png', {
attribution: 'FR-ADM © <a href="http://wiki.openstreetmap.org/wiki/FR:Servers/tile.openstreetmap.fr">OSM-FR/cquest</a>',
minZoom: 8,
maxZoom: 20
});
var qa = L.tileLayer('https://{s}.tile.openstreetmap.fr/qa/{z}/{x}/{y}.png', {
attribution: 'QA © <a href="http://wiki.openstreetmap.org/wiki/FR:Servers/tile.openstreetmap.fr">OSM-FR/cquest</a> - données OSM/INSEE/DGFiP',
minZoom: 1,
maxZoom: 20
});
var bano = L.tileLayer('https://{s}.layers.openstreetmap.fr/bano/{z}/{x}/{y}.png', {
attribution: '<a href="https://wiki.openstreetmap.org/wiki/WikiProject_France/WikiProject_Base_Adresses_Nationale_Ouverte_(BANO)">BANO</a> - Calque © <a href="http://wiki.openstreetmap.org/wiki/User:Cquest">cquest</a>',
minZoom: 1,
maxZoom: 20
});
var wms = L.tileLayer('http://wms.openstreetmap.fr/tms/1.0.0/tous_fr/{z}/{x}/{y}', {
attribution: 'images aériennes en opendata (sources diverses)',
minZoom: 1,
maxZoom: 20
});
var cadastre = L.tileLayer('https://tms.cadastre.openstreetmap.fr/*/tout/{z}/{x}/{y}.png', {
attribution: 'cadastre',
minZoom: 1,
maxZoom: 20
});
var cadastreT = L.tileLayer('https://tms.cadastre.openstreetmap.fr/*/transp/{z}/{x}/{y}.png', {
attribution: 'cadastre transparent',
minZoom: 1,
maxZoom: 20
});
var oim_attr = '<a href="https://openinframap.org/about.html">About OpenInfraMap</a>'
var oim_tileserver = 'https://tiles-{s}.openinframap.org';
var power = L.tileLayer(oim_tileserver + '/power/{z}/{x}/{y}.png',
{attribution: oim_attr});
var comms = L.tileLayer(oim_tileserver + '/telecoms/{z}/{x}/{y}.png',
{attribution: oim_attr});
var petroleum = L.tileLayer(oim_tileserver + '/petroleum/{z}/{x}/{y}.png',
{attribution: oim_attr});
var water = L.tileLayer(oim_tileserver + '/water/{z}/{x}/{y}.png?2',
{attribution: oim_attr});
var hft = L.tileLayer(oim_tileserver + '/microwave_hft/{z}/{x}/{y}.png?1',
{attribution: 'Ofcom, <a href="https://carte-fh.lafibre.info/">carte-fh.lafibre.info</a>'});
//OverPassAPI overlay
var opl = new L.OverPassLayer({
minzoom: 10,
query: "node(BBOX)['historic'='memorial'];out;",
callback: function(data) {
for(var i=0;i<data.elements.length;i++) {
var e = data.elements[i];
if (e.id in this.instance._ids) return;
this.instance._ids[e.id] = true;
var pos = new L.LatLng(e.lat, e.lon);
var popup = this.instance._poiInfo(e.tags,e.id);
var color = e.tags["ref:FR:MemorialGenWeb"] ? 'green':'red';
var link = document.createElement("a");
link.target="_blank";
link.href = "http://rawedit.openstreetmap.fr/edit/node/" + e.id;
link.appendChild(document.createTextNode("RawEdit"));
popup.appendChild(link);
var link2 = document.createElement("a");
link2.target="_blank";
link2.href = "http://www.memorialgenweb.org/memorial3/html/fr/resultcommune.php?idsource=" + e.tags["ref:FR:MemorialGenWeb"];
link2.appendChild(document.createTextNode("|MemorialGenWeb"));
popup.appendChild(link2);
var circle = L.circle(pos, 50, {
color: color,
fillColor: '#fa3',
fillOpacity: 0.5
})
.bindPopup(popup);
this.instance.addLayer(circle);
}
},
});
//OverPassAPI overlay
var egl = new L.OverPassLayer({
minzoom: 10,
query: "node(BBOX)['amenity'='place_of_worship'];out;",
callback: function(data) {
for(var i=0;i<data.elements.length;i++) {
var e = data.elements[i];
if (e.id in this.instance._ids) return;
this.instance._ids[e.id] = true;
var pos = new L.LatLng(e.lat, e.lon);
var popup = this.instance._poiInfo(e.tags,e.id);
var color = e.tags["ref:FR:CEF"] ? 'green':'red';
var link = document.createElement("a");
link.target="_blank";
link.href = "http://rawedit.openstreetmap.fr/edit/node/" + e.id;
link.appendChild(document.createTextNode("RawEdit"));
popup.appendChild(link);
var link2 = document.createElement("a");
link2.target="_blank";
link2.href = "http://egliseinfo.catholique.fr/lieu/" + e.tags["ref:FR:CEF"];
link2.appendChild(document.createTextNode("|CEF"));
popup.appendChild(link2);
var circle = L.circle(pos, 50, {
color: color,
fillColor: '#fa3',
fillOpacity: 0.5
})
.bindPopup(popup);
this.instance.addLayer(circle);
}
},
});
// todo : complete
var siren = new L.uGeoJSONLayer({
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, geojsonMarkerOptionsSIRENE);
},
minzoom: 12,
endpoint:"https://data.opendatasoft.com/api/records/1.0/search/?dataset=sirene%40public&rows=30&format=geojson&q=apet700+%3D+"+APE_param+"&facet=categorie&facet=proden&facet=libapen&facet=siege&facet=libreg_new&facet=saisonat&facet=libtefen&facet=depet&facet=libnj&facet=libtca&facet=liborigine&exclude.libapen=Location+de+logements%2C+Conseil+pour+les+affaires+et+autres+conseils+de+gestion&exclude.libapen=Location+de+logements&exclude.libapen=Location+de+terrains+et+d%27autres+biens+immobiliers",
debug: false,
usebbox: true,
onEachFeature: onEachFeatureSIRENE,
});
//var ggl = new L.Google();
//var ggl2 = new L.Google('TERRAIN');
// liste des couches de base
var baseMaps = {
//"Rendu HOT-HDM": hot,
"OSM/Mapnik - international": osm,
"Rendu FR": osmfr,
//"DigGlobe": digglobe,
//"DigGlobe2": digglobe2,
//"Mapbox": mapbox,
"Carto": carto,
//"MapQuest": mapquest,
"Outdoor": outdoors,
//"Cycle": cycle,
"Transport": transport,
//"Landscape": landscape,
"OpenRiverBoat": river,
//"OSM monochrome": bw,
"Cadastre": cadastre,
//"GMap": ggl
//"GMap2": ggl2
//"IGN Ortho": ortho
};
var overlays = {
"Sirene": siren,
"Route500 IGN": route500,
"BD Carthage": carthage,
"OpenSeaMap": sea,
//"Ombrage": relief,
"Mapillary": mapillary,
"Limites admin. FR": fradm,
"Volta" : volta,
"BDTopo": bdtopo,
//"Régions": adm4,
//"Départements": adm6,
//"Arrondissements": adm7,
//"Communes": adm8,
"'QA' - Zone à compléter": qa,
"'BANO' - Couverture": bano,
//"Images aériennes opendata": wms,
"Cadastre Transparent": cadastreT,
"Monuments aux morts":opl,
"Eglises": egl,
"Electricité": power,
"Telecoms": comms,
"Petroleum": petroleum,
"Water": water,
"Microwave (HFT)": hft
};
var searchPoints = L.geoJson(null, {
onEachFeature: function (feature, layer) {
layer.bindPopup(feature.properties.name);
}
});
function showSearchPoints(geojson) {
console.debug('begin handler');
searchPoints.clearLayers();
searchPoints.addData(geojson);
console.debug('end handler');
};
function myHandler(geojson) {
console.debug(geojson);
};
var formatResult = function (feature, el) {
var title = L.DomUtil.create('strong', '', el),
detailsContainer = L.DomUtil.create('small', '', el),
details = [];
title.innerHTML = feature.properties.label || feature.properties.name;
var types = {
housenumber: 'numéro',
street: 'rue',
locality: 'lieu-dit',
hamlet: 'hameau',
village: 'village',
city: 'ville',
commune: 'commune'
};
if (types[feature.properties.type]) L.DomUtil.create('span', 'type', title).innerHTML = types[feature.properties.type];
if (feature.properties.city && feature.properties.city !== feature.properties.name) {
details.push(feature.properties.city);
}
if (feature.properties.context) details.push(feature.properties.context);
detailsContainer.innerHTML = details.join(', ');
};
var SHORT_CITY_NAMES = ['y', 'ay', 'bu', 'by', 'eu', 'fa', 'gy', 'oo', 'oz', 'py', 'ri', 'ry', 'sy', 'ur', 'us', 'uz'];
var photonControlOptions = {
resultsHandler: showSearchPoints,
placeholder: 'Adresse',
position: 'topleft',
url: 'https://api-adresse.data.gouv.fr/search/?',
formatResult: formatResult,
noResultLabel: 'Aucun résultat',
minChar: function (val) {
return SHORT_CITY_NAMES.indexOf(val) !== -1 || val.length >= 3;
},
submitDelay: 200
};
// création de la carte, centrée sur la France
map = L.map('map', { center: [47.000,2.000], zoom: 10, layers: [osm], editInOSMControlOptions: { position: 'bottomright' }, photonControl: true, photonControlOptions: photonControlOptions } );
searchPoints.addTo(map);
// ajout de l'échelle
L.control.scale().addTo(map);
// ajout de la géolocalisation
var lc = L.control.locate({ follow: false, setView: false, keepCurrentZoomLevel: true }).addTo(map);
//map.locate({watch: true});
map.on('dragstart', lc._stopFollowing, lc);
// ajout du sélecteur de couches
L.control.layers(baseMaps, overlays).addTo(map);
// ajout de la position du curseur
L.control.mousePosition( { position: 'bottomright' } ).addTo(map);
// ajout de la gestion des URL
var hash = new L.Hash(map);
</script>
</body>
</html>