You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-map...@googlegroups.com
I've been trying to pass 5 markers to a map and have the map center around the points but am not able to get it to function for me anymore. This is my first time working with the V3 api so I'm not sure if I've done something wrong as well.
var lat = new Array(); var lng = new Array(); lat[0] = 0; lat[1] = 1; lat[2] = 2; lat[3] = 3; lat[4] = 4; lat[5] = 5; lng[0] = 6; lng[1] = 7; lng[2] = 8; lng[3] = 9; lng[4] = 10 lng[5] = 11; for (var i = 0; i < 5; i++) { var location = new google.maps.LatLng(lat[i], lng[i]); var marker = new google.maps.Marker({ position: location, map: map }); var j = i + 1; marker.setTitle(j.toString()); var bounds = new google.maps.LatLngBounds(lat[i], lng[i]); map.fitBounds(bounds); }
> Line 12
>
> when I try that code, get only 2 markers and it doesn't zoom or center.
> When I change it to
>
> var bounds = new google.maps.LatLngBounds(lat[0], lng[5]);
LatLngBounds(sw?:LatLng, ne?:LatLng) Constructs a rectangle from the
points at its south-west and north-east corners.
That is not a valid call to the constructor for LatLngBounds...
-- Larry
Chris Macdonald
unread,
Nov 30, 2010, 1:16:46 AM11/30/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-map...@googlegroups.com
In my old v2 code I had this (not directly, within some other loops, but similiar)
var bounds = new GLatLngBounds(); bounds.extend(point); map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
to center it around the points of the map.
I thought that function would select the furthest ne point and furthest sw point from the array value. This would then create the rectangle to show all the values within that.
geoco...@gmail.com
unread,
Nov 30, 2010, 1:20:38 AM11/30/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Maps JavaScript API v3
On Nov 30, 1:16 am, Chris Macdonald <thebluewal...@gmail.com> wrote:
> In my old v2 code I had this (not directly, within some other loops,
> but similiar)
That code is not the same. If you had done that in v3 it would have
worked.