On Mar 3, 5:43 am, jplozano <jploza...@gmail.com> wrote: > Hi everybody, > > I'm have this code: > > var latlngbounds = new google.maps.LatLngBounds(A, B); > mapt.fitBounds(latlngbounds); > > For example, A = London and B = Barcelona gives mehttp://prntscr.com/1lqs5 > But when I change it to: A = London and B = Montevideo, it gives > mehttp://prntscr.com/1lqsc(map splitted) > > I have read that this issue depends on the order of A and B. If I > reorder the arguments resulting in LatLngBounds(Montevideo, London) > instead of LatLngBounds(London, Montevideo) it works just fine. > > The problem with all this is that A and B are random based on the user > input, so I have no clue when to switch from A,B to B,A or viceversa. > > This is driving me crazy!!!
Did you read the documentation on LatLngBounds? http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLngBounds LatLngBounds(sw?:LatLng, ne?:LatLng) Constructs a rectangle from the points at its south-west and north-east corners The two arguments are not A and B, they are SouthWestCorner and NorthEastCorner. If you want a bounds object that contains two arbitrary points, use LatLngBounds.extend on an empty bounds object. -- Larry > Thanks in advance. > > Juan -- 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-maps-js-api-v3@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.