let marcador = new ol.Feature({ | |
geometry: new ol.geom.Point( | |
ol.proj.fromLonLat([-99.12105, 19.419617])// En dónde se va a ubicar | |
), | |
}); | |
// Agregamos icono | |
marcador.setStyle(new ol.style.Style({ | |
image: new ol.style.Icon({ | |
src: "pizza.png", | |
}) | |
})); | |
// marcadores debe ser un arreglo | |
const marcadores = []; // Arreglo para que se puedan agregar otros más tarde | |
marcadores.push(marcador);// Agregamos el marcador al arreglo | |
let capa = new ol.layer.Vector({ | |
source: new ol.source.Vector({ | |
features: marcadores, // A la capa le ponemos los marcadores | |
}), | |
}); | |
// Y agregamos la capa al mapa | |
mapa.addLayer(capa); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment