Does this sound like a viable solution? I have a table of all the towns and villages in the UK in the format
id, townOrVillage, county, lat, lng Could I precomute the bounding rectangle for every county by using the geodata for each town or village in the county and working out the 4 outermost points? Just an idea that has just sprung to mind. I could probably live with using a point reference for villages and towns but for counties I really need to use the bounding rectangle. Thanks Paul On Sep 20, 4:29 pm, "Paul Steven" <[email protected]> wrote: > Thanks Mike - that looks like a reasonable solution - certainly the only > solution I have found yet. > > Many thanks > > Paul > > -----Original Message----- > From: [email protected] > > [mailto:[email protected]] On Behalf Of Mike Williams > Sent: 20 September 2009 08:57 > To: [email protected] > Subject: Re: How to get outer bounds of an area/region > > The geocoder returns an ExtendedData section that represents the box > that maps.google.com uses to determine the zoom. Note that the Lat/Lng > box isn't a perfect fit for the target location. It's just there to > provide sensible zooming. > > For example, try typing "Oxford" into this page: > http://econym.org.uk/gmap/example_geo3.htm > The blue rectangle indicates the geocoder ExtendedData.LatLonBox. > > You could calculate the lat and lng distances of the corners from the > centre and add a percentage. > > Using the variables of example_geo3.htm that would look something like: > var percent = 15; > var cLat = result.Placemark[0].Point.coordinates[1]; > var cLng = result.Placemark[0].Point.coordinates[0]; > N += (N-cLat)*percent/100; > S += (S-cLat)*percent/100; > W += (W-cLng)*percent/100; > E += (E-cLng)*percent/100; > var bounds = new GLatLngBounds(new GLatLng(S,W), new GLatLng(N,E)); > > Or you could use the EOffset() function from eshapes.js > > NE = EOffset(new GLatLng(N,E), 5*1609.344, 5*1609.344); > SW = EOffset(new GLatLng(S,W), -5*1609.344, -5*1609.344); > > [There are 1609.344 metres in a mile.] > > -- > Mike Williamshttp://econym.org.uk/gmap > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en -~----------~----~----~----~------~----~------~--~---
