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

164
Views
setIcon() changing Icon but not changing addressable DOM on map with large number of markers

I’m first changing the icon of a marker with .setIcon(). Then I’m rotating the icon with:

$('img[src="https://' + thedomain +
    '/xplorit_common/assets/SVG/map_radar.svg"]').css({
  'transform': 'rotate(' + adj_offset_bearing + 'deg)',
});

Everything works just fine with a small number of markers. But when I have upwards of 200+ markers the icon will not rotate. The marker image does change but the <img> src attribute does not change when viewing Elements in Dev Tools( even when searching for map_radar.svg ). Which, circling back, makes sense as to the icon not rotating; since the value is not actually addressable in the DOM. But does not make sense that the "correct" icon is visible

I’ve beaten this horse to death and need some outside input. Any ideas?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Set optimized:false option

If you use specific markers with custom icons with .svg, you can experiment some difficulties with large number of markers. To bypass this problem, you need to disable the optimized rendering property set by default when you build a marker. To do it, just add line optimized:false when you set each of your markers:

var marker = new google.maps.Marker({
   position: myLatlng,
   map: myGmap,
   icon: {url: mySvgIconUrl},
   optimized: false
});

Or do it with the setOption() method :

marker.setOptions({'optimized':false});

For more infos about it you can look this section of the documentation

about 4 years ago · Santiago Trujillo Report
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!