-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrte.html
661 lines (577 loc) · 22.8 KB
/
rte.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
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
<!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>
<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'>
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: 4,
fillColor: "#ff7800",
color: "#000",
weight: 1,
opacity: 1,
fillOpacity: 0.8
};
String.prototype.capitalize = function(){
return this.toLowerCase().replace( /\b\w/g, function (m) {
return m.toUpperCase();
});
};
function PowerPaint(feature) {
var myStyle = {
"color": "#ff7800",
"fillColor": "#ff7800",
"weight": 3,
"opacity": 0.65,
"dashArray": null,
};
switch (feature.properties.tension) {
case '400kV': myStyle.color="#e4080e"; break;
case '225kV': myStyle.color="#068d00"; break;
case '150kV': myStyle.color="#0a33af"; break;
case '90kV': myStyle.color="#ff7f00"; break;
case '63kV': myStyle.color="#9f024c"; break;
};
myStyle.fillColor=myStyle.color;
switch (feature.properties.type_ouvrage) {
case 'SOUTERRAIN': myStyle.opacity=0.5; myStyle.dashArray="5, 10";break;
case 'AERIEN': myStyle.opacity=1; myStyle.dashArray=null;break;
};
myStyle.weight=2;
switch (feature.properties.nombre_de_circuits) {
case 1: myStyle.weight=1; break;
case 2: myStyle.weight=3; break;
case 3: myStyle.weight=6; break;
};
return myStyle;
};
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>"
// );
if (feature.properties.nom_ouvrage) {
feature.properties.nom_ouvrage_1=feature.properties.nom_ouvrage;
}
if (feature.properties.nom_poste) {
feature.properties.nom_ouvrage_1=feature.properties.nom_poste;
}
if (feature.properties.nom_ligne) {
feature.properties.nom_ouvrage_1=feature.properties.nom_ligne;
}
if (feature.properties.fonction_poste) {
feature.properties.nom_identification_2=feature.properties.fonction_poste;
}
if (feature.properties.code_ligne) {
feature.properties.identification_1=feature.properties.code_ligne;
}
if (feature.properties.identification) {
feature.properties.identification_1=feature.properties.identification;
}
if (feature.properties) { // && feature.properties.geoshape) {
var myStyle = {
"color": "#ff7800",
"weight": 2,
"opacity": 0.65,
"dashArray":null,
};
if (feature.properties.identification_2) {
myStyle.weight=4;
};
if (feature.properties.identification_3) {
myStyle.weight=6;
};
if (feature.properties.identification_4) {
myStyle.weight=8;
};
if (feature.properties.identification_5) {
myStyle.weight=10;
};
myStyle.weight=2;
myStyle.color="#f00c1f";
switch (feature.properties.tension) {
case '400kV': myStyle.color="#e4080e"; myStyle.weight=6; break;
case '225kV': myStyle.color="#068d00"; myStyle.weight=5; break;
case '150kV': myStyle.color="#0a33af"; myStyle.weight=4; break;
case '90kV': myStyle.color="#ff7f00"; myStyle.weight=2; break;
case '63kV': myStyle.color="#9f024c"; myStyle.weight=2; break;
};
switch (feature.properties.type_ouvrage) {
case 'SOUTERRAIN':
myStyle.opacity=0.5;
myStyle.dashArray="5, 10";
// souterrain.addData(feature.properties.geoshape);
break;
case 'AERIEN':
myStyle.opacity=1;
myStyle.dashArray=null;
// aerien.addData(feature.properties.geoshape);
break;
};
switch (feature.properties.nombre_de_circuits) {
case 1: myStyle.weight=2; break;
case 2: myStyle.weight=4; break;
case 3: myStyle.weight=6; break;
case 4: myStyle.weight=8; break;
case 5: myStyle.weight=10; break;
};
// fGeoJSON.addData(feature.properties.geoshape);
L.geoJSON(feature.properties.geo_shape_segment,{style: myStyle}).addTo(map);
L.geoJSON(feature.properties.geo_shape,{style: myStyle}).addTo(map);
};
// type_ouvrage
// etat
layer.bindPopup(`<table><tr><th>clé</th><th>valeur</th></tr>
<tr><td>name</td><td>${feature.properties.nom_ouvrage_1}</td></tr>
<tr><td>voltage</td><td>${feature.properties.tension}</td></tr>
<tr><td>circuits</td><td>${feature.properties.nombre_de_circuits}</td></tr>
<tr><td>ref</td><td>${feature.properties.identification_1}</td></tr>
<tr><td>ref2</td><td>${feature.properties.identification_2}</td></tr>
<tr><td>ref3</td><td>${feature.properties.identification_3}</td></tr>
<tr><td>ref4</td><td>${feature.properties.identification_4}</td></tr>
<tr><td>ref5</td><td>${feature.properties.identification_5}</td></tr>
<tr><td>precision</td><td>${feature.properties.classe_de_precision}</td></tr>
<tr><td>etat</td><td>${feature.properties.etat}</td></tr>
</table>
`);
//}
}
// 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( 'http://{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('http://{s}.tile.openstreetmap.fr/route500/{z}/{x}/{y}.png', {
attribution: 'Route500 © IGN - LO/OL',
minZoom: 1,
maxZoom: 20
});
var carthage = L.tileLayer('http://{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('http://{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 adm4 = L.tileLayer('http://{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('http://{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('http://{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('http://tms.cadastre.openstreetmap.fr/*/tout/{z}/{x}/{y}.png', {
attribution: 'cadastre',
minZoom: 1,
maxZoom: 20
});
var cadastreT = L.tileLayer('http://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: 12,
query: "node(BBOX)['shop'='supermarket'];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["name"] ? '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 circle = L.circle(pos, 50, {
color: color,
fillColor: '#fa3',
fillOpacity: 0.5
})
.bindPopup(popup);
this.instance.addLayer(circle);
}
},
});
// todo : complete
var postes = new L.uGeoJSONLayer({
pointToLayer: function (feature, latlng) {
var emprise=10;
//
switch (feature.properties.tension) {
case '400kV': emprise=200; break;
case '225kV': emprise=150; break;
case '150kV': emprise=120; break;
case '90kV': emprise=80; break;
case '63kV': emprise=60; break;
};
return L.rectangle(latlng.toBounds(emprise), geojsonMarkerOptionsSIRENE);
},
minzoom: 16,
endpoint:"https://opendata.reseaux-energies.fr/api/records/1.0/search/?dataset=postes-electriques-rte&rows=200&format=geojson",
debug: false,
usebbox: true,
onEachFeature: onEachFeatureSIRENE,
style : PowerPaint,
});
var pylones = new L.uGeoJSONLayer({
pointToLayer: function (feature, latlng) {
var emprise=10;
//
switch (feature.properties.tension) {
case '400kV': emprise=20; break;
case '225kV': emprise=15; break;
case '150kV': emprise=12; break;
case '90kV': emprise=8; break;
case '63kV': emprise=6; break;
};
return L.rectangle(latlng.toBounds(emprise), geojsonMarkerOptionsSIRENE);
},
minzoom: 16,
endpoint:"https://opendata.reseaux-energies.fr/api/records/1.0/search/?dataset=pylones-rte&rows=200&format=geojson",
debug: false,
usebbox: true,
onEachFeature: onEachFeatureSIRENE,
style : PowerPaint,
});
var souterrain = new L.uGeoJSONLayer({
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, geojsonMarkerOptionsSIRENE);
},
minzoom: 15,
endpoint:"https://opendata.reseaux-energies.fr/api/records/1.0/search/?dataset=lignes-souterraines-rte&rows=200&format=geojson",
debug: false,
usebbox: true,
onEachFeature: onEachFeatureSIRENE,
style : PowerPaint,
});
var aerien = new L.uGeoJSONLayer({
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, geojsonMarkerOptionsSIRENE);
},
minzoom: 15,
endpoint:"https://opendata.reseaux-energies.fr/api/records/1.0/search/?dataset=lignes-aeriennes-rte&rows=200&format=geojson",
debug: false,
usebbox: true,
onEachFeature: onEachFeatureSIRENE,
style : PowerPaint,
});
var postes_enedis = new L.uGeoJSONLayer({
pointToLayer: function (feature, latlng) {
var emprise=20;
return L.rectangle(latlng.toBounds(emprise));
},
minzoom: 16,
endpoint:"https://data.enedis.fr/api/records/1.0/search/?dataset=poste-electrique&rows=200&format=geojson",
debug: false,
usebbox: true,
onEachFeature: onEachFeatureSIRENE,
style : PowerPaint,
});
var aerien_hta_enedis = new L.uGeoJSONLayer({
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, geojsonMarkerOptionsSIRENE);
// return false;
},
minzoom: 15,
endpoint:"https://data.enedis.fr/api/records/1.0/search/?dataset=reseau-hta&rows=200&format=geojson",
debug: false,
usebbox: true,
onEachFeature: onEachFeatureSIRENE,
style : PowerPaint,
});
var souterrain_hta_enedis = new L.uGeoJSONLayer({
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, geojsonMarkerOptionsSIRENE);
// return false;
},
minzoom: 15,
endpoint:"https://data.enedis.fr/api/records/1.0/search/?dataset=reseau-souterrain-hta&rows=200&format=geojson",
debug: false,
usebbox: true,
onEachFeature: onEachFeatureSIRENE,
style : PowerPaint,
});
//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,
//"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 = {
"Aerien HTB": aerien,
"Souterrain HTB": souterrain,
"Pylones RTE": pylones,
"Postes RTE": postes,
"Postes Enedis": postes_enedis,
"Aerien HTA": aerien_hta_enedis,
"Souterrain HTA": souterrain_hta_enedis,
//"Route500 IGN": route500,
//"BD Carthage": carthage,
//"OpenSeaMap": sea,
//"Ombrage": relief,
//"Limites admin. FR": fradm,
//"Régions": adm4,
//"Départements": adm6,
//"Arrondissements": adm7,
//"Communes": adm8,
//"'QA' - Zone à compléter": qa,
//"'BANO' - Couverture": bano,
//"Images aériennes opendata": wms,
//"Supermarket": opl,
"Cadastre Transparent": cadastreT,
//"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: 14, layers: [osm], editInOSMControlOptions: { position: 'bottomright' }, photonControl: true, photonControlOptions: photonControlOptions } );
searchPoints.addTo(map);
var fGeoJSON = L.geoJSON(
{
type: 'FeatureCollection',
features: []
},
{
style : PowerPaint,
}).addTo(map);
// ajout de l'échelle
L.control.scale().addTo(map);
// ajout de la géolocalisation
var lc = L.control.locate({ follow: false, setView: 'once', 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>