We have a locational search (using circular search filter in the View) available for our member groups across the UK: https://makingmusic.org.uk/resources/find-a-group-list

Entering cities/towns by name such as 'London' returns results correctly, but where there is a town/city with the same name abroad (e.g. 'Durham' or 'Cambridge' which both also exist in the US) no results are returned unless the country is included: 'Durham, UK' or 'Cambridge, UK'.

Since the search should only cover the UK (and so there shouldn't be a conflict caused by a place name existing outside the UK) is there a setting where I can limit the search criteria so that it only looks for places in the UK (and so doesn't get stuck where the name appears somewhere other than the UK as well)?


The Geofield proximity Views filter doesn't have any default location settings. The filter passes the given string value on through to the geocoder without any additional settings:

  $geocoded_data_raw = geocoder($geocoder_engine, $location);

As such, your only option is to form alter the submitted data as answered in this question:

 * Implements hook_form_views_exposed_form_alter().
function MYMODULE_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
  array_unshift($form['#submit'], 'MYMODULE_form_views_exposed_form_submit');

 * Modify submission value with " UK" if given origin has been supplied.
function MYMODULE_form_views_exposed_form_submit($form, &$form_state) {
  if (isset($form_state['values']['field_geofield_distance']['origin']) && 
      strlen($form_state['values']['field_geofield_distance']['origin']) > 0) {
    $form_state['values']['field_geofield_distance']['origin'] .= ' UK';
|improve this answer|||||

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.