Zoom on getCurrentPosition marker

52 views
Skip to first unread message

ghettoglenn

unread,
Nov 3, 2011, 4:05:32 AM11/3/11
to google-map...@googlegroups.com
I have a Google Map that displays retailers on a map. The data is loaded from Fusion Tables and the map is optimised for iphone display. The retailers are mapped then a marker (flag icon) is dropped for your current location. Once that happens I want the map to automatically zoom into the vicinity of the marker (eg. zoom into the Suburb rather than display whole State). I've been banging my head all afternoon trying to get this to work. Can anyone help me out?

Here is the map I'm working on:
http://stage.lotterywest.wa.gov.au/retailer/iphone-location.html

Thanks!

geoco...@gmail.com

unread,
Nov 9, 2011, 8:52:07 AM11/9/11
to Google Maps JavaScript API v3
On Nov 3, 12:05 am, ghettoglenn <ghettogl...@gmail.com> wrote:
> I have a Google Map that displays retailers on a map. The data is loaded
> from Fusion Tables and the map is optimised for iphone display. The
> retailers are mapped then a marker (flag icon) is dropped for your current
> location. Once that happens I want the map to automatically zoom into the
> vicinity of the marker (eg. zoom into the Suburb rather than display whole
> State). I've been banging my head all afternoon trying to get this to work.
> Can anyone help me out?

You have 2 choices I can think of (I'm sure there are lots of ways to
do this):
1. Use the geocoder to geocode the "Suburb" and use the resulting
viewport or bounds to center and zoom the map (.fitBounds)
2. Since you only return results from querying your Fusion Table, add
a bounds or a center and zoom, or just a zoom to the table and use
that to zoom the map.

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