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

256
Vistas
How to rotate markers individually in openlayers

I want to display on duty taxi positions using openlayers. I have coordinates and heading of each taxi cab but when I'm trying to display them everything is okay with coordinates but headings aren't displaying properly. It's because I have the same style for every marker and adding them to the same vector layer. I would like to show each vehicle with its own heading. Any solutions for this issue will be appreciated.

My code:

    var taxiMarker = new ol.style.Style({
         image: new ol.style.Icon({
           scale: 0.7, anchor: [0.5, 0.5],
           src: 'uploads/taxiMarker.png'
         })
    });
    var taxi_vector = new ol.layer.Vector({
        source: new ol.source.Vector({
        }),
        style: [taxiMarker]
    });

    for(let i = 0; i < res.length; i++) {
         let tCoords = res[i][0].split(',');
         let heading = parseFloat(res[i][1]);
         let marker = new ol.geom.Point(tCoords);
         let featureMarker = new ol.Feature(marker);
         taxiMarker.getImage().setRotation(heading);
         taxi_vector.getSource().addFeature(featureMarker);
    }
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