4

I'm running D7. I'm trying to figure out how to a) tag users with a location (ZIP, address, city, state, etc.) when they register an account, and b) set up a search where the visitor inputs their location (via ZIP, address, etc.), and it returns a list of every registered user sorted by their proximity to the inputted location in the search. I'm more interested in an answer to part b) since it seems more complicated, but honestly any help at this point would be very appreciated. I've been stuck for a few weeks now.

Thanks, Edward Sapp

3

There are two basic approaches for doing locations in D7:

According to Karen Stevenson's presentation at Do It With Drupal 2011, only location/gmap currently has location proximity search working in D7... but not very well.

Based on this presentation and the book Mapping with Drupal, I set up proximity search on my own site using the location module. It works, but it's not terribly user friendly, it's a pain to theme, and it's still clearly under development. However, it's a far better solution than I would have been able to arrive at rolling my own.

1

I think, that one of possible solutions is http://drupal.org/project/location. It has location_user module, which allows you to store such data.

What is quite nice about that module, is a fact, that it also supports geolocation, based on user input (zip, state, country, etc). It has two backends for geolocation (zip database is required, see: http://drupal.org/node/1038010 for more information) or google maps api.

With properly geolocated users, you can create view (location module has views integration) with proximity as sort criteria.

I played with such solution on D6 and it worked for me. I see that location has D7 dev version, so it should be doable on D7 as well.

1

I was able to setup a user proximity search for D7 with the following combo of geo modules on drupal.org.

openlayers

addressfield

geofield

geocoder

The last one is on github ...(The existing module on drupal.org does not cover users yet).

https://github.com/FeyP/proximity

Using that combo and views make it relatively easy to set up a user proximity search.

To get it to work you will have to add an address field and a geofield to the user profile. Set the geofield to "Geocode from another field" and it will automatically store the correct geo location info from the address field. Then in a user view you can use the Proximity filters supplied by the github module for filtering proximity on address,zip-codes etc etc. Within a certain distance.

There is also a features module that has great views example for a regular node proximity search. This module uses the same module recipe from above except for the proximity module but the github code will work as well because it forked from the original and just adds entity support for user locations.

http://drupal.org/project/ol_locator

1

I found this website that may assist you with your proximity search (b). I substituted OpenLayers for GMAP and was still able to get my proximity search working. http://torontowebsitedeveloper.com/drupal-video-tutorials/creating-drupal-7-proximity-search

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.