Use different marker icon based on zoom level?

New home Forums Basic Version General queries Use different marker icon based on zoom level?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #33612
    edash22
    Member

    I would like to use a smaller marker icon when the map is zoomed out to a higher level as the map gets very cluttered. I’m not a fan of clustering, so I’d prefer to not use that solution. Is there a way to specify that at certain zoom levels a different marker icon be used? I almost wondered if this could be achieved in CSS or JS? Can you provide guidance on how to dynamically change the marker icon that is displayed based on zoom level? Thank you!

    #33628
    Perry
    Moderator

    Hi there

    Thanks for getting in touch!

    There are options under Maps -> Settings -> Marker Clustering where you can adjust the cluster icons and advanced clustering settings.

    Unfortunately there is no way to use CSS to customize marker icons as they’re rendered on a canvas by Googles API, however you can access markers through marker_array[map_id][marker_id] (see https://developers.google.com/maps/documentation/javascript/markers for documentation on what’s available through there)

    You can listen for events on the map through google.maps.event.addListener(MYMAP[map_id].map, “zoom_changed”, function() {});

    You could use your event listener to iterate through the markers and set a custom icon based on zoom level this way.

    Would that work for you?

    Kind regards
    – Perry

    #33654
    edash22
    Member

    Thanks!! That’s great advice. I’ll give the listener a try.

    I really appreciate your quick response on this too!

    e-

    #33657
    Perry
    Moderator

    Hi there,

    You’re most welcome!

    Is there anything else I can help you with?

    Kind regards
    – Perry

    #34083
    Perry
    Moderator

    Hi there

    The best thing to do would be to disable it on the other plugin and allow our plugin to load the API if that’s possible.

    If not then I can provide you with a small plugin that achieves this.

    May I ask what feature that is?

    Kind regards
    – Perry

    #34151
    Perry
    Moderator

    Hi there,

    The correct way to do this would be to dequeue their script on pages that use ours.

    I’ll add a feature request for adding KML files via shortcode.

    Kind regards
    – Perry

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.