Thursday, August 30, 2012

[Google Maps API v2] Re: Fastest method of finding items inside a bounding box

agree John, For a rough geographical search eg within 20k's, even down here in NZ where we have a big difference between a degree of lat and one of long, this seems to be the fastest search ( in sql)
Having trouble understanding why mysql does not support a simple radius search. 

On Tuesday, April 3, 2007 4:59:27 PM UTC+12, JCamp...@gmail.com wrote:
If you want a really simple solution and don't mind a "rectangular"
search radius instead of a round one.  Just make sure lat,lng are
indexed and write the query like:

SELECT fish_name WHERE lat > $low_lat AND lat < $high_lat AND lng >
$low_lng AND lng < $high_lng

This query is fast because it can use the index.  If you do a distance
computation in SQL, you have to do it on every row.

A lazy way to compute the $low_lat,$high_lat, etc. is to just assume 1
degree ~= 40,000/360 km.

-John Campbell

--
You received this message because you are subscribed to the Google Groups "Google Maps API V2" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-api/-/w-kfMflSZ0EJ.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate