-
-
Save parzibyte/2dfa28ff303a8348e82d233079064758 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!mapa) { | |
// Primera vez, lo creamos y centramos | |
mapa = new ol.Map({ | |
target: 'mapa', // el id del elemento en donde se monta | |
layers: [ | |
new ol.layer.Tile({ | |
source: new ol.source.OSM() | |
}) | |
], | |
view: new ol.View({ | |
center: ol.proj.fromLonLat([longitude, latitude]), | |
zoom: ZOOM, | |
}) | |
}); | |
marcador = new ol.Feature({ | |
geometry: new ol.geom.Point( | |
ol.proj.fromLonLat([longitude, latitude]) | |
), | |
}); | |
marcador.setStyle(new ol.style.Style({ | |
image: new ol.style.Icon(({ | |
src: icono, | |
scale: 0.5, // Aquí puedes ampliar o disminuir la imagen | |
})), | |
})); | |
const ultimaCapa = new ol.layer.Vector({ | |
source: new ol.source.Vector({ | |
features: [marcador], | |
}), | |
}); | |
mapa.addLayer(ultimaCapa); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment