Geocode Search Field for Drupal Views Argument
I'm attempting to show a location proximity Drupal View which takes the gecoded lat/long from user input.
This way, when a user types in "chi开发者_如何学Pythoncago, il" or simply "central park, nyc", a geocoded lat/long value is passed as an argument to Views.
I think I'm on the right track with the geocode module and gmap google maps api, but don't know where to go from there.
I've been tooling around for this kind of solution for some time, but it looks like, right now, the only way to do this would be to use the aforementioned modules and create your own views filter (look at the Location module for an example) to send the proper coordinates (geocoded from Google or someone else's API) to the Views map you're using.
I have a solution on one of my sites that allows users to enter their zip code to get a close approximation of where they are—this is using the Location module—but it's not as precise (or elegant) as geocoding an address or city-level marker.
See: http://www.opensourcecatholic.com/blog/oscatholic/beautiful-easy-maps-drup - there's a video explaining how I have the maps set up on http://archstl.org/parishes
[Edit: also, read through this thread on drupal.org to see if it helps - http://drupal.org/node/904576 - I really wish there were an easier solution that didn't involve so many different modules!]
Drupal 7, as of June 13, 2012, stay with the Location 7.x-3.x DEV version of the Location http://drupal.org/project/location module. That's the only easy way to get a proximity filter into view. Geofield is way too new to work. The Location module's zip code proximity filter requires you to populate the "zipcodes" database table. Make sure you read the README for how to install it!
精彩评论