How to reduce options for units of measurement to just miles and km for proximity search Using geofield with Views and exposed filters to the user to search for things on the map within a certain radius of a particular location.

I only require miles and kilometres as units of measurement, not: Yards, Feet, Nautical Miles. Any way to omit these?

They are defined in the module geofield's file, geofield.elements.inc code:

/**
 * Returns options for radius of the Earth.
 */

function geofield_radius_options() {
  return array(
    GEOFIELD_KILOMETERS =&gt; t('Kilometers'),
    GEOFIELD_METERS =&gt; t('Meters'),
    GEOFIELD_MILES =&gt; t('Miles'),
    GEOFIELD_YARDS =&gt; t('Yards'),
    GEOFIELD_FEET =&gt; t('Feet'),
    GEOFIELD_NAUTICAL_MILES =&gt; t('Nautical Miles'),
  );
}


But I don't want to hack this and remove them. 

The approach I am expecting to use would be to implement hook_form_alter in my own module and remove the options from there.

But is there a better way?
Another approach is simply using CSS.

The select list is built like this:

&lt;select&gt;
  &lt;option value="6371"&gt;Kilometres&lt;/option&gt;
  &lt;option value="6371000"&gt;Metres&lt;/option&gt;
  &lt;option value="3959"&gt;Miles&lt;/option&gt;
  &lt;option value="6975175"&gt;Yards&lt;/option&gt;
  &lt;option value="20925525"&gt;Feet&lt;/option&gt;
  &lt;option value="3444"&gt;Nautical Miles&lt;/option&gt;
&lt;/select&gt;


You could hide the undesired values with the following style (in this case only "kilometres" and "miles" remain):

option[value="6371000"], 
option[value="6975175"],
option[value="20925525"],
option[value="3444"]{
  display: none;
}


If you're only using one value, it may look a bit silly to have a select box of it. You could disguise it as regular text though. Make sure the font is identical to the rest, remove the border, set a width to the container of the select list and hide everything seeping out of it, whilst making the select list a tad longer (thus the dropdown arrow gets hidden by the overflow):

.form-item-field-geofield-distance-unit{
    width: 90px;
    overflow: hidden;
}

select{
    width: 120px;
    border: 0;
    cursor: text;
}


Alternatively (Bootstrap 3):

.form-item-field-geofield-distance-unit select{
    border: 0 !important;
    box-shadow: none;
    cursor: text;
    -moz-appearance: none;
    -webkit-appearance: none;
    appearance: none;
}


Adjust the margins or paddings if necessary…