geolocation - fastest way to find geo points within a range in mysql -
i query possible streetnames within radius of 500 meters of given point. multiple posts reffering google store locator example using haversine formula or version of it. came across posts have much more simplified solution.
they treat points x,y coordinates adding lat , long variables seen below.
i wandering if fastest way query mysql without getting complicated , still result. don't have lot of data yet, want know if on right track. there disadvantages or inaccuracy's using method?
what don't how can radius range, looks more 1 directional query?
distance = 0.1; // range in degrees (0.1 degrees close 11km) latn = lat + distance; lats = lat - distance; lone = lon + distance; lonw = lon - distance; ...query db following: select * table_name (store_lat between latn , lats) , (store_lon between lone , lonw)
ithink can use spatial indexes in mysql in case, read more this: http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html
Comments
Post a Comment