Answers.Body: <p>As luck would have it, I was over at the Drupal project review queue and found exactly what I was looking for. It's currently on its path to being approved (hopefully soon) and currently it only supports UK postal codes but this is what I expect will be the answer (it's a sandbox project at this time):</p>
  
  <p>CiviCRM contact distance search
  <a href="https://www.drupal.org/sandbox/vakeesan26/2498395" rel="nofollow">https://www.drupal.org/sandbox/vakeesan26/2498395</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-24T17:18:14.890Z
Answers.LastActivityDate: 2015-06-24T17:18:14.890Z
Answers.UserDisplayName: Andrew Wasson
Answers.Body: <p>I have recently updated the module to allow a map and use your location. More info can be found here - <a href="https://civicrm.org/blog/anil/drupal-views-civicrm-contact-distance-search-with-a-map" rel="nofollow noreferrer">https://civicrm.org/blog/anil/drupal-views-civicrm-contact-distance-search-with-a-map</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-04T08:53:48.203Z
Answers.LastActivityDate: 2018-06-04T08:53:48.203Z
Answers.UserDisplayName: Vakees
Answers.Body: <p>You would need to do some custom work to get this exposed to a public page I suspect, but CiviCRM already provides radius search, based on Zip Code.</p>
  
  <p>First you need to turn on geocoding which will go get the latitude/longitudes for all the contacts you have (based on their zip code).  Go here to set up: civicrm/admin/setting/mapping  (note you have to allow civi the time to fully geocode your contacts as well.)</p>
  
  <p>Then in Advanced Search, you can search a zip code, and say you would like to search a specific radius around that zip.  (Note if geocoding is not turned on, the option to specify a radius is not displayed.)</p>
  
  <p>Using Drupal Views, assuming you are geocoding,you may be able to create a view based on a radius using that stored lat/long (though that may be prohibitive CPU wise). Depends on how many contacts you need to filter.  (Probably need to use a PHP filter in the view to calc the distance on each contact to determine inclusion.)</p>
  
  <p>(Google for the algorithm to calc distances on lat/long)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T18:44:16.750Z
Answers.LastActivityDate: 2015-06-19T19:05:30.160Z
Answers.LastEditDate: 2015-06-19T19:05:30.160Z
Answers.UserDisplayName: DaveD
Body: <p>I tend to do a lot of roster pages on Drupal + CiviCRM sites (Drupal Views, exposing CiviCRM contact record fields). One of the search filters I'd like to try would be to allow visitors to enter a postal/zip code and then have results from contacts that are located in a radius to the postal code. I know CiviCRM has some ability to geocode contact addresses. Is there any way we can harness the goecoding into a postal/zip filter for this type of search?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-20T00:26:45.033Z
Comments.Text: When using Lat Long in Views we have used OpenLayers module to generate maps. Had no luck with proximity search at the time but things might have progressed though a quick look at status of https://www.drupal.org/project/openlayers_proximity suggests that may not be the solution (yet)
Comments.UserDisplayName: petednz - fuzion
Tags: <search><drupal-views>
Title: Search by radius to postal code or zip
ThreadText: # Search by radius to postal code or zip
  
  (Asked by: username_0 on 2015-06-18)
  
  I tend to do a lot of roster pages on Drupal + CiviCRM sites (Drupal Views, exposing CiviCRM contact record fields). One of the search filters I'd like to try would be to allow visitors to enter a postal/zip code and then have results from contacts that are located in a radius to the postal code. I know CiviCRM has some ability to geocode contact addresses. Is there any way we can harness the goecoding into a postal/zip filter for this type of search?
  
  **Tags:** search, drupal-views
  
  > **Comments:**
  > **username_1**: When using Lat Long in Views we have used OpenLayers module to generate maps. Had no luck with proximity search at the time but things might have progressed though a quick look at status of https://www.drupal.org/project/openlayers_proximity suggests that may not be the solution (yet)  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_0 on 2015-06-24. Score: 1 | Accepted answer
  
  As luck would have it, I was over at the Drupal project review queue and found exactly what I was looking for. It's currently on its path to being approved (hopefully soon) and currently it only supports UK postal codes but this is what I expect will be the answer (it's a sandbox project at this time):
  
  CiviCRM contact distance search
  <https://www.drupal.org/sandbox/vakeesan26/2498395>
  
  
  ---
  
  ### Answer by username_2 on 2018-06-04. Score: 2
  
  I have recently updated the module to allow a map and use your location. More info can be found here - <https://civicrm.org/blog/anil/drupal-views-civicrm-contact-distance-search-with-a-map>
  
  
  ---
  
  ### Answer by username_3 on 2015-06-19. Score: 1
  
  You would need to do some custom work to get this exposed to a public page I suspect, but CiviCRM already provides radius search, based on Zip Code.
  
  First you need to turn on geocoding which will go get the latitude/longitudes for all the contacts you have (based on their zip code). Go here to set up: civicrm/admin/setting/mapping (note you have to allow civi the time to fully geocode your contacts as well.)
  
  Then in Advanced Search, you can search a zip code, and say you would like to search a specific radius around that zip. (Note if geocoding is not turned on, the option to specify a radius is not displayed.)
  
  Using Drupal Views, assuming you are geocoding,you may be able to create a view based on a radius using that stored lat/long (though that may be prohibitive CPU wise). Depends on how many contacts you need to filter. (Probably need to use a PHP filter in the view to calc the distance on each contact to determine inclusion.)
  
  (Google for the algorithm to calc distances on lat/long)
  
  
  ---
  
  