Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

270
Views
¿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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!