Resizing placemark icons as zoom extent changes?

3,447 views
Skip to first unread message

Dan Bowerman

unread,
Oct 1, 2009, 8:42:20 AM10/1/09
to KML Developer Support - Getting Started with KML
My instinctive answer to this question is "no", but I am wondering if
there is any feasible way to have the scale of a placemark's icon
change as you zoom in or out? Such that if I am zoomed out to where I
see many points scattered, the icons appear small, but if I zoom in
closely where I only see a few points, they become larger?

Thanks,
Dan

Barry Hunter

unread,
Oct 1, 2009, 9:23:31 AM10/1/09
to KML Developer Support - Getting Started with KML
You can, but only distinct transition. You can regions to create one
set of small icons that show when far away, and a bigger set that
shows when zoomed it. It does mean need to duplicate the placemarks.

An alternative is to use Models for the icons, they use a fixed 'real
world' size rather than a fixed screen size, so naturally get smaller
as zoom out.

Barry Hunter

unread,
Oct 1, 2009, 9:27:06 AM10/1/09
to KML Developer Support - Getting Started with KML

Filip Joosen

unread,
Jun 11, 2012, 5:22:04 AM6/11/12
to kml-support-g...@googlegroups.com
Are you using a KML layer, or are you manually (or script wise :)) adding Markers to the google map?

1. If Markers:
     You could use different images. For example, set a callback function to trigger on the 'zoom_changed' map event. In that callback, check the map's zoom level and set the myMarker.MarkerImage to the corresponding image (eg 'myPoint-small.png' and 'myPoint-big.png'. You can swap images like that, and I have a similar setup with my application so I can confirm that it works like that (does take a long time if you have a lot of markers to check/change).

2. If KML layer:
     Sadly, you can't. KML layers bring EVERY icon to 32x32px size, regardless of it being smaller or bigger that 32x32. So you ca

Op donderdag 1 oktober 2009 14:42:20 UTC+2 schreef Dan Bowerman het volgende:

Filip Joosen

unread,
Jun 11, 2012, 5:23:44 AM6/11/12
to kml-support-g...@googlegroups.com
Addition to the previous post I made:

"So you can still change the icons by using another KML layer. But the image size will always be 32x32px unfortunately.


This all assuming you're using the Google Maps API v2 or v3 :) Google Earth does support different image sizes but not the Maps API."


Op donderdag 1 oktober 2009 14:42:20 UTC+2 schreef Dan Bowerman het volgende:
My instinctive answer to this question is "no", but I am wondering if
Reply all
Reply to author
Forward
0 new messages