stretch map independantly of the canvas size

68 views
Skip to first unread message

Bas van de Lustgraaf

unread,
Nov 27, 2011, 7:15:37 PM11/27/11
to google-map...@googlegroups.com
how to manage that the map is as big as the canvas (div) based on fixed bounds coordinates? So basically the same map appears independantly if the canvas is 200x200 or 600x600.

Marcelo

unread,
Nov 27, 2011, 8:42:00 PM11/27/11
to Google Maps JavaScript API v3
You cannot do that exactly because zoom levels are discrete values.
The only way to make it fit would be to reduce or increase the size of
the canvas in multiples of 2, ie. 200x200 pixels at zoon 4 would show
the same area as 400x400 pixels at zoom 5, and so on.

--
Marcelo - http://maps.forum.nu
--

On Nov 27, 5:15 pm, Bas van de Lustgraaf <basvdlustgr...@gmail.com>
wrote:

Bas van de Lustgraaf

unread,
Nov 28, 2011, 6:33:58 AM11/28/11
to google-map...@googlegroups.com
ok, makes sence, but how to display the right area based on the fixed bounds?

Andrew Leach

unread,
Nov 28, 2011, 7:34:41 AM11/28/11
to google-map...@googlegroups.com
On 28 November 2011 11:33, Bas van de Lustgraaf

<basvdlu...@gmail.com> wrote:
> ok, makes sence, but how to display the right area based on the fixed
> bounds?

fitBounds(...) perhaps?

http://code.google.com/apis/maps/documentation/javascript/reference.html#Map

It's not entirely clear to me what you're requesting. Are you content
that a larger canvas will allow a deeper zoom while showing
[approximately] the same land area? fitBounds() will do that.

Reply all
Reply to author
Forward
0 new messages