You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @teeparham, I was wondering if there is method or recommended approach to queries where you are looking for records in a certain radius of a point? I tried looking thru the docs but couldn't find the right solution.
I assume this is a common case, so if there is a recommended solution that is not documented, I'm happy to PR the docs.
Thank you!
The text was updated successfully, but these errors were encountered:
I covered this briefly in my RailsConf 2012 talk on the subject. My recommendation (assuming you have records in a PostGIS database, suitably indexed) is to create a st_buffer polygon of the desired radius, and then query for records whose geometry st_intersects that polygon. This should allow the query optimizer to apply the index. Sample code is on slide 63. (It uses Squeel syntax which is somewhat defunct, but it should communicate the concept well enough.)
Hi @teeparham, I was wondering if there is method or recommended approach to queries where you are looking for records in a certain radius of a point? I tried looking thru the docs but couldn't find the right solution.
I assume this is a common case, so if there is a recommended solution that is not documented, I'm happy to PR the docs.
Thank you!
The text was updated successfully, but these errors were encountered: