Scaling markers with zoom

3,933 views
Skip to first unread message

dbrb2

unread,
Nov 24, 2010, 8:13:19 PM11/24/10
to google-map...@googlegroups.com
From what I have read both here and elsewhere, this is not possible, save by looping through every marker when zoom level is changed - but just to check: 

Does anyone know of a way to scale markers as a user zooms in / out

I have a map full of markers at http://cycleHire.eu/mobile that look fine at high zoom, but when zoomed right out the size of the markers becomes silly!

I may just have to live with it, but thought I'd check here for inspiration!



CroNiX

unread,
Nov 24, 2010, 10:44:28 PM11/24/10
to Google Maps JavaScript API v3
Do your markers need to be that big? You might also look into the
MarkerClusterer. It won't scale your icons, but it will "group" icons
that are touching until zoomed in far enough that they don't touch
then they show up normally.

On Nov 24, 5:13 pm, dbrb2 <benjamin.bar...@gmail.com> wrote:
> From what I have read both here and elsewhere, this is not possible,
> save by looping through every marker when zoom level is changed - but
> just to check:
>
> Does anyone know of a way to scale markers as a user zooms in / out
>
> I have a map full of markers athttp://cycleHire.eu/mobilethat look

dbrb2

unread,
Nov 25, 2010, 3:23:38 AM11/25/10
to google-map...@googlegroups.com
I will look into the markerManager - cheers

Wrt size, I was trying to find a medium between too large and so small that, on a phone browser, they appear tiny, but I expect there is some leeway to fiddle around

CroNiX

unread,
Nov 26, 2010, 1:49:24 PM11/26/10
to Google Maps JavaScript API v3
Another option might be to have different sized icons, and at
different zoom levels you can loop through your markers and change the
icon to a smaller/larger one.

wi...@sparkgeo.com

unread,
Nov 26, 2010, 2:56:46 PM11/26/10
to google-map...@googlegroups.com
its also possible to differentiate between different (bigger or smaller) markers depending on browser type... just a thought :)

geoco...@gmail.com

unread,
Nov 26, 2010, 3:05:34 PM11/26/10
to Google Maps JavaScript API v3
On Nov 24, 8:13 pm, dbrb2 <benjamin.bar...@gmail.com> wrote:
> From what I have read both here and elsewhere, this is not possible,
> save by looping through every marker when zoom level is changed - but
> just to check:
>
> Does anyone know of a way to scale markers as a user zooms in / out
>
> I have a map full of markers athttp://cycleHire.eu/mobilethat look
> fine at high zoom, but when zoomed right out the size of the markers
> becomes silly!
>
> I may just have to live with it, but thought I'd check here for
> inspiration!

Have you looked at the "scaledSize" option for the MarkerImage class?
http://code.google.com/apis/maps/documentation/javascript/reference.html#MarkerImage

You will need to write code to change the scale base on zoom, but I
think it will do what you are looking for.

-- Larry
Reply all
Reply to author
Forward
0 new messages