You are here

function geocoder_google_form in Geocoder 7

Plugin callback.

1 string reference to 'geocoder_google_form'
google.inc in plugins/geocoder_handler/google.inc

File

plugins/geocoder_handler/google.inc, line 252

Code

function geocoder_google_form($default_values = array()) {
  $form = array();
  $form['geometry_type'] = array(
    '#type' => 'select',
    '#title' => 'Geometry Type',
    '#options' => array(
      'point' => 'Point (default)',
      'bounds' => 'Bounding Box',
      'viewport' => 'Viewport',
    ),
    '#default_value' => isset($default_values['geometry_type']) ? $default_values['geometry_type'] : 'point',
  );
  $form['all_results'] = array(
    '#type' => 'checkbox',
    '#title' => 'Geocode all alternative results',
    '#default_value' => isset($default_values['all_results']) ? $default_values['all_results'] : FALSE,
    '#description' => 'Often an ambiguous address (such as "Springfield USA") can result in multiple hits. By default we only return the first (best guess) result. Check this to return all results as a Multi-Geometry (MultiPoint or MultiPolygon).',
  );
  $form['reject_results'] = array(
    '#type' => 'checkboxes',
    '#title' => 'Reject Results',
    '#options' => array(
      'APPROXIMATE' => 'APPROXIMATE:  indicates that the returned result is approximate.',
      'GEOMETRIC_CENTER' => 'GEOMETRIC_CENTER: indicates that the returned result is the geometric center of a result such as a polyline (for example, a street) or polygon (region).',
      'RANGE_INTERPOLATED' => 'RANGE_INTERPOLATED: indicates that the returned result reflects an approximation (usually on a road) interpolated between two precise points (such as intersections). Interpolated results are generally returned when rooftop geocodes are unavailable for a street address.',
      'ROOFTOP' => 'ROOFTOP: indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision.',
    ),
    '#default_value' => isset($default_values['reject_results']) ? $default_values['reject_results'] : array(),
    '#description' => 'Reject results that do not meet a certain level of quality or precision. Check all types of results to reject.',
  );
  $form['biasing'] = array(
    '#type' => 'fieldset',
    '#title' => t('Result biasing'),
    '#description' => t('To help reduce ambiguous results you can set give preference to or restrict results using viewports biasing, region biasing and component filtering. Please see !link for details on how to use these options.', array(
      '!link' => l(t('The Google Geocoding API'), 'https://developers.google.com/maps/documentation/geocoding/'),
    )),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['biasing']['bounds'] = array(
    '#type' => 'textfield',
    '#title' => t('Viewport biasing'),
    '#description' => t('Provide latitude/longitude coordinates of the southwest and northeast corners using a pipe (|) to separate the coordinates.'),
    '#default_value' => isset($default_values['biasing']['bounds']) ? $default_values['biasing']['bounds'] : NULL,
  );
  $form['biasing']['region'] = array(
    '#type' => 'textfield',
    '#title' => t('Region biasing'),
    '#description' => t('Provide a ccTLD for the desired region.'),
    '#default_value' => isset($default_values['biasing']['region']) ? $default_values['biasing']['region'] : NULL,
  );
  $form['biasing']['components'] = array(
    '#type' => 'textfield',
    '#title' => t('Component filtering'),
    '#description' => t('Provide a set of component:value pairs separated by a pipe (|) to filter results.'),
    '#default_value' => isset($default_values['biasing']['components']) ? $default_values['biasing']['components'] : NULL,
  );
  return $form;
}