How Can I Create Static Marker In Openlayers 3?
I don't have a great level in javascript and OpenLayers, and i am trying to realize a map with static markers pointing airports in all the world. Well i tried to search my answer b
Solution 1:
(fiddle)
var vectorLayer = new ol.layer.Vector({
source: new ol.source.Vector({
format: new ol.format.GeoJSON(),
url: 'url_of_your_file'
})
});
map.addLayer(vectorLayer);
This way you can load a GeoJSON file into your map.
If you want, say, a circle marker you add a style to ol.layer.Vector
like:
var vectorLayer = new ol.layer.Vector({
source: new ol.source.Vector({
format: new ol.format.GeoJSON(),
url: 'url_of_your_file'
}),
style: new ol.style.Style({
image: new ol.style.Circle({
radius: 10,
fill: new ol.style.Fill({
color: '#ffff00'
})
})
})
});
Post a Comment for "How Can I Create Static Marker In Openlayers 3?"