The function function geocode($input, $options) as an $options param but it's not used in the fuction. The $input pass trought urlencode so you can't pass extra params tought this one. Now if you see the http://code.google.com/intl/fr/apis/maps/documentation/geocoding/ sensors and key is requiered so i think we can use $options for this like that:
require_once(drupal_get_path('module','geocode').'/includes/geocode.inc');
$geocode = new geocode_google();
$options = '&key=' . variable_get('googlemap_api_key', ''); //take the gmap key
$options .= '&sensor=false';
$googleQuery = $assigned['city'].'+Switzerland';
$ret = $geocode->geocode($googleQuery,$options);
In the file geocode.inc
function geocode($input, $options) {
if (is_array($input)) $input = join(',', $input);
$url = "http://maps.google.com/maps/geo?";
$url .= 'q='. urlencode($input);
$url .= $options;
$url .= '&output=json&oe=utf-8';
$ret = drupal_http_request($url);
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 606380-geocode-options.patch | 1.59 KB | mr.baileys |
Comments
Comment #1
mr.baileysAgreed - I'm trying out Geocode for a project of mine, but in order to be useful I need to be able to pass options:
I've rolled a patch that refactors the geocode call as follows:
Current invocations of geocode() will continue to work, but after applying this patch you can use the follow calls: