You are here

function geocoder_openstreetmap_nominatim in Geocoder 7

Process Markup.

1 call to geocoder_openstreetmap_nominatim()
geocoder_openstreetmap_nominatim_field in plugins/geocoder_handler/openstreetmap_nominatim.inc
Plugin callback.
1 string reference to 'geocoder_openstreetmap_nominatim'
openstreetmap_nominatim.inc in plugins/geocoder_handler/openstreetmap_nominatim.inc

File

plugins/geocoder_handler/openstreetmap_nominatim.inc, line 28

Code

function geocoder_openstreetmap_nominatim($address, $options = array()) {
  $api_url = 'http://nominatim.openstreetmap.org/';
  $params = array(
    'q' => str_replace(' ', '+', $address),
    'format' => 'json',
    'addressdetails' => 0,
    'limit' => 1,
    'osm_type' => 'N',
  );
  $request = drupal_http_request($api_url . '?' . urldecode(drupal_http_build_query($params)));
  $data = json_decode($request->data);
  return _geocoder_openstreetmap_nominatim_geometry($data);
}