Finding members within a certain radius of a location

450 views
Skip to first unread message

kay s

unread,
Jan 29, 2014, 5:36:49 PM1/29/14
to mpls-stpau...@googlegroups.com
Hi everyone:

I have a client who wants to be able to select a location (one of several the organization uses) and get a list of all the members within a, say, 5-mile radius of that location or a specific distance from a zipcode.  They also have a couple other conditions to be met, such as skill level, etc., but the distance is a key need.  And the distance may change--it's not consistent.

I found a plugin called "Find Your Nearest," but it appears to be finding the nearest one thing, not a whole bunch of people,

I'm wondering if anyone has any ideas about how to do this.  I'd appreciate hearing about it/them if you do.

Thanks,
Kay

Nicholas Ciske

unread,
Jan 29, 2014, 8:53:26 PM1/29/14
to mpls-stpau...@googlegroups.com

Howie Burke

unread,
Jan 29, 2014, 9:39:47 PM1/29/14
to mpls-stpau...@googlegroups.com
Not sure if it applies to your situation, but there's a plugin called WP Ultimate Search (Premium version) that can run radius searches against ACF (Advanced Custom Fields plugin) map fields.  This would assume, though, that your members are in Wordpress as a custom post type, rather than as standard Wordpress users.

Also, there's one called GEO my WordPress, that would seem to work if you're using BuddyPress for member management.

Howie Burke

Steve Horton

unread,
Jan 30, 2014, 10:48:23 AM1/30/14
to mpls-stpau...@googlegroups.com

barbara schendel

unread,
Jan 30, 2014, 5:00:08 PM1/30/14
to mpls-stpau...@googlegroups.com
I am using a great little plugin called Geo Mashup for this. It even works with custom post types too. Each post gets its own location and then the main find-a-location page lets you search through them by city or zip or it has a "find my location" button too. Then it lists them all in order of distance from you. I have found it to work well and be easy to set up. 


--
You received this message because you are subscribed to the Google Groups "Minneapolis St. Paul WordPress User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mpls-stpaul-word...@googlegroups.com.
To post to this group, send email to mpls-stpau...@googlegroups.com.
Visit this group at http://groups.google.com/group/mpls-stpaul-wordpress.
For more options, visit https://groups.google.com/groups/opt_out.

Nicholas Ciske

unread,
Jan 31, 2014, 10:26:53 AM1/31/14
to mpls-stpau...@googlegroups.com
Just a note on performance when doing distance searches:

Sorting X records by distance from the user requires computing the distance for every record, then sorting by that, then returning the number of records requested.

You're sorting by a dynamically generated field (e.g. there's no index to speed things up) so every record gets touched at least twice (once to calculate, once to sort). That's a lot of work to return the 5 closest stores. Paginated results may run that query several times (unless it's cached by MySQL or WP) to serve up results.

Depending on the number of records and number of searchers per hour/minute, you can quickly overload any DB server with these types of searches.

You can optimize a bit by excluding records that would never be viable options (e.g. use a geofence -- someone in CA is unlikely to be in the top results for someone searching in NY) to reduce the performance hit. Not sure if any of the plugins mentioned do that. I'd suspect not, as it requires assumptions that are different per implementation.

So, tread carefully to avoid bringing down your DB server (and with WP, your site).

_________________________
Nick Ciske
http://thoughtrefinery.com/
@nciske

kay s

unread,
Feb 4, 2014, 6:31:34 PM2/4/14
to mpls-stpau...@googlegroups.com
Thank you everyone for all the suggestions. And thanks, Nick, for the warning.

It's a tennis club and the distances are from the member's addresses to the various tennis courts they play on.  Organizers want to be able to call people who live near the tennis court they're scheduling. I have a few plugins to try out.  Thanks, again.

--Kay
Reply all
Reply to author
Forward
0 new messages