Filtering on user location

Events happening in the community are now at Drupal community events on www.drupal.org.
dpatte's picture

I have just launched a website for dance in Ottawa Canada. www.dance-ottawa.com

The site currently uses no custom php, and only a few minor theme changes to get the results I wanted.

I had to add user locations to each user (I would have preferred to use cck locations, but user locations work).
My dance organization & venue types have cck location fields.

Now, assuming that users actually fill out their location when logged in, the site generates tables of dance organizations and venues sorted by distance from the user, and can specify the distance from the user. Handy!

But I have run into an interesting situation...

Though fields can determine the distance from each user, there seems no way that I can filter my nodes based on the distance from current user. I can calculate the distance from a user, but not filter on that distance. I can filter on a static point only (or a zip code - which doesnt work for me).

it would be nice if:
- I could filter out all nodes greater than a specific distance from the users location
- it would be especially nice if i could fallback to a static location (the parliament buildings in Ottawa), if the user has not specified a location, or the user has not logged in.
- it would be super-especially nice if the filter distance could be exposed.

Any ideas how to do this?

Eventually, I hope to provide several sites all accessing the same database, but with different default fallback locations.
The ultimate filter would bean exposed filter which provided a list of all my node's cities, as well as a 'use my location' option; and a distance in km or miles. I figure most of the code to do this is already there, if its tweaked.

Location and Mapping

Group organizers

Group categories

Wiki type

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: