1107 shaares
52 private links
52 private links
1 result
tagged
openlayer
/* Création d'une carte vide */
var map = new ol.Map({
target: "map",
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
view: new ol.View({
center: ol.proj.fromLonLat([12.5, 41.9]),
zoom: 4
})
});
/* Creation de point */
var rome = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.fromLonLat([12.5, 41.9]))
});
/* Création du layer de points */
var vectorLayer = new ol.layer.Vector({
source: new ol.source.Vector({
features: [rome] // Liste de points
})
});
/* Ajout du calque de points à la carte */
map.addLayer(vectorLayer);