Bonjour,
Avec OpenLayers, je cr�e une carte, avec un fond OSM, et je voudrais ajouter deux vector Layer et type GeoJson (un de type Point et un de type LineString)
Voici mon code:Les featurescollections nari_dynamic_sar et nari_dynamic_sar_lines sont stock�es dans des constantes, la structure est ok.
Code : S�lectionner tout - Visualiser dans une fen�tre � part
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 const osmLayer = new TileLayer({ preload: Infinity, source: new OSM(), }) const map = new Map({ target: "map", layers: [osmLayer], view: new View({ center: [0, 0], zoom: 0, }), }); const format = new GeoJSON({ featureProjection: 'EPSG:3857' }); const features = format.readFeatures(nari_dynamic_sar); const vectorLayer = new VectorLayer({ source: new VectorSource({ features }), }); const format_lines = new GeoJSON({ featureProjection: 'EPSG:3857' }); const features_lines = format_lines.readFeatures(nari_dynamic_sar_lines); const vectorLayer_lines = new VectorLayer({ source: new VectorSource({ features_lines }), style : new Style({ stroke: new Stroke({ color: '#ff3333', width: 3 }) }) }); map.addLayer(vectorLayer); map.addLayer(vectorLayer_lines);
Le probl�me est que le premier GeoJson (vectorLayer) s'affiche, mais pas le deuxi�me (vectorLayer_lines). Pourquoi ?
Merci,
Nico
Partager