Need help with setting center and zoom levels.

22 views
Skip to first unread message

jim

unread,
Jun 4, 2010, 4:10:46 AM6/4/10
to Google Maps JavaScript API v3
In v2 I did basically

make a map centered on 0,0 with zoom 0
create GlatLngBounds
read my data file
for each point
create a marker
bounds.extend(marker point)
endfor
set map zoom
set map center

I'm not doing a very good job of figuring it out in v3. My (broken)
code is here
http://jim.hollenback.org/Maps/HelloWorld.html

I would appreciate pointers what I should be looking for and/or
examples. I did not have much luck with the search.

Thanks!

ricco *

unread,
Jun 4, 2010, 4:53:06 AM6/4/10
to google-map...@googlegroups.com
Hello,

I don't know if this can help but i see:
	bounds.extend(google.maps.LatLng(lat, lon));

it seems to me that it should be:
bounds.extend(new google.maps.LatLng(lat, lon));

but maybe this is not the problem. I advise you to use firebug console.

Cheers


2010/6/4 jim <j...@hollenback.org>

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


William

unread,
Jun 4, 2010, 5:18:09 AM6/4/10
to Google Maps JavaScript API v3
also move the map.fitBounds(bounds); inside the $.get() function

});
map.fitBounds(bounds);
},'xml');

jim

unread,
Jun 4, 2010, 5:59:14 PM6/4/10
to Google Maps JavaScript API v3
Thanks ricco and William, life is good.
Reply all
Reply to author
Forward
0 new messages