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

255
Views
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
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!