I have the following script for render an OpenLayer3 map into a div in my web The map is showed on the web when de user click on a button.
function traza_mapa() {
function clearTheDiv()
{
document.getElementById("map").innerHTML = "";
};
clearTheDiv();
var myVista = new ol.View({
center: ol.proj.fromLonLat([-30,50],'EPSG:3857', 'EPSG:4326'),
zoom: 4,
});
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
],
view: myVista,
controls: new ol.control.defaults({
zoom: true,
attribution: false,
})
});
map.addControl(new ol.control.ZoomSlider());
};
I would like to show a track as a layer. The vertex positions are obtained from a array [[lon1,lat1],[lon2, lat2]]..................]
How can I include the array as as layer into the map ?