Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

264
Vistas
¿Cómo mostrar información usando Overlay en Openlayers?

Tenía un vector en mi mapa con una imagen, pero necesitaba usar gif en lugar de una imagen estática, así que o.layer.vector por ol.Overlay , muestra mi gif pero no puedo agregarlo a mi layerSwitcher porque overlay no tiene propiedad de title , también con vector podría mostrar información usando forEachFeaturePixel pero ahora no puedo. ¿Hay alguna forma de agregar mi overlay a layerSwitcher y mostrar información al hacer clic en ella?

Esto es lo que tenía:

 lastPoint = new ol.layer.Vector({ source: new ol.source.Vector({ features: [new ol.Feature( new ol.geom.Point( ol.proj.fromLonLat(lastCoordinates, map.getView().getProjection()) ) )] }), visible: true, title: "Evento sísmico", style: new ol.style.Style({ image: new ol.style.Icon({ anchor: [0.5, 0.5], size: [30, 28], offset: [0.2, 0.2], scale: 1, src: "assets/img/red-point.png" }), }), }) addEarthqPoint = (e, map, clickedCoordinate, date, time, depth, magnitude, overlayLayerEarthq) => { map.forEachFeatureAtPixel(e.pixel, () => { overlayLayerEarthq.setPosition(clickedCoordinate); overlayTitleEarthq.innerHTML = "Detalle de evento: " overlayFeatureDate.innerHTML = "Fecha: " + date; overlayFeatureTime.innerHTML = "Hora (UTC-5): " + time; overlayFeatureDepth.innerHTML = "Profundidad: " + depth + " km"; overlayFeatureMagnitude.innerHTML = "Magnitud: M " + magnitude; }, { layerFilter: (layerCandidate) => { return layerCandidate.get("title") === "Evento sísmico"; } }); } mapClicked = (overlayLayer, overlayLayerEarthq) => { map.on("click", function (e) { const clickedCoordinate = e.coordinate; overlayLayer.setPosition(undefined); overlayLayerEarthq.setPosition(undefined); /* using preview values to use into function */ addEarthqPoint(e, map, clickedCoordinate, lastDate, lastTime, lastDepth, lastMagnitude, overlayLayerEarthq); }); }

Esta es mi nueva superposición:

 lastPoint = new ol.Overlay({ position: ol.proj.fromLonLat(lastCoordinates, map.getView().getProjection()), positioning: 'center-center', element: document.getElementById('new-gif'), stopEvent: false });

¿O hay alguna forma mejor de usar un gif en lugar de una imagen?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda