Geocode an address and callback with zip5, address (formatted address),
and location (lat, lng) properties
767148
function geocode(address, callback) {
  var query = qs.stringify({ address: address, sensor: false, components: 'country:US' })
    , reqtmpl = "http://maps.googleapis.com/maps/api/geocode/json?%s"
    , req = util.format(reqtmpl, query)
    , geo
    ;
  
  request(req, function(err, res, body) {
    if (err) {
      console.log('ERROR: ' + err);
      return callback(err);
    }

    console.log(body);

    geo = parseGoogleGeocodes(JSON.parse(body));

    if (!geo) {
      return callback("can't determine address");
    } else {
      return callback(null, geo);
    }
  });
}
693060
public function geoCoder($lat, $lng, $ak, $mcode, $url)
    {
        $client = new \GuzzleHttp\Client();

        $parameters = [
            'form_params' => [
                'ak'       => $ak,
                'location' => $lat . ',' . $lng,
                'output'   => 'json',
                'pois'     => 0,
                'mcode'    => $mcode,
            ],
        ];

        $geo_coder = $client->request('POST', $url, $parameters);
        $geo_coder = json_decode($geo_coder->getBody());

        return $geo_coder;
    }
1251556
def geocode(lat, lon, options = {})
      new(options.merge(lat: lat, lon: lon)).retrieve
    end
475803
function ( loc, cbk, opts ) {

    if ( ! loc ) {
        return cbk( new Error( "Geocoder.geocode requires a location.") );
    }

    return this.providerObj.geocode(this.providerOpts, loc, cbk, opts);

  }
785753
public function getCoordinatesForAddress($street = null, $zip = null, $city = null, $country = ''): array
    {
        $addressParts = [];
        foreach ([$street, $zip . ' ' . $city, $country] as $addressPart) {
            if (empty($addressPart)) {
                continue;
            }
            $addressParts[] = trim($addressPart);
        }
        $address = ltrim(implode(',', $addressParts), ',');
        if (empty($address)) {
            return [];
        }
        $cacheObject = $this->initializeCache();
        $cacheKey = 'geocode-' . strtolower(str_replace(' ', '-', preg_replace('/[^0-9a-zA-Z ]/m', '', $address)));
        // Found in cache? Return it.
        if ($cacheObject->has($cacheKey)) {
            return $cacheObject->get($cacheKey);
        }
        $result = $this->getApiCallResult(
            $this->geocodingUrl . '&address=' . urlencode($address)
        );
        if (empty($result) || empty($result['results']) || empty($result['results'][0]['geometry'])) {
            return [];
        }
        $geometry = $result['results'][0]['geometry'];
        $result = [
            'latitude' => $geometry['location']['lat'],
            'longitude' => $geometry['location']['lng'],
        ];
        // Now store the $result in cache and return
        $cacheObject->set($cacheKey, $result, [], $this->cacheTime);
        return $result;
    }
1138589
function HereGeocoder(httpAdapter, options) {
  this.options = ['appId', 'appCode', 'language', 'politicalView', 'country', 'state'];

  HereGeocoder.super_.call(this, httpAdapter, options);

  if (!this.options.appId || !this.options.appCode) {
    throw new Error('You must specify appId and appCode to use Here Geocoder');
  }
}
415586
function standardizeAddress(address, callback) {
	var url = address_url + encodeURIComponent(address) + '?format=json';
	request(url, function(err, resp, body) {
		var error = resp.statusCode != 200 ? new Error('Unable to standardize address') : err;
		callback(error, body);
	});
}
227702
private static function _latLngFromAddress_Here ($token, $address, $country)
	{
		$url = 'https://geocoder.api.here.com/6.2/geocode.json';
		$url .= '?app_id=' . $token['appId'];
		$url .= '&app_code=' . $token['appCode'];
		$url .= '&language=' . \Craft::$app->locale->getLanguageID();
		$url .= '&searchtext=' . rawurlencode($address);

		if ($country !== null)
		{
			if (static::_validateCountryCode($country))
				$url .= '&country=' . rawurlencode(strtoupper($country));
			else
				$url .= rawurlencode(', ' . $country);
		}

		$data = (string) static::_client()->get($url)->getBody();
		$data = Json::decodeIfJson($data);

		if (!is_array($data) || empty($data['Response']['View']))
			return null;

		$pos = $data['Response']['View'][0]['Result'][0]['Location']['DisplayPosition'];

		return [
			'lat' => $pos['Latitude'],
			'lng' => $pos['Longitude'],
		];
	}
872862
def geocode(self, string, bounds=None, region=None,
                language=None, sensor=False):
        '''
        '''
        if isinstance(string, unicode):
            string = string.encode('utf-8')

        params = {
            'address': self.format_string % string,
            'sensor': str(sensor).lower()
        }

        
        if bounds:
            params['bounds'] = bounds
            
        if region:
            params['region'] = region
            
        if language:
            params['language'] = language
            

        if not self.premier:
            url = self.get_url(params)
        else:
            url = self.get_signed_url(params)

        return self.GetService_url(url)
31313
function() {
			this.writeDebug('htmlGeocode',arguments);
			var _this = this;

			if (_this.settings.sessionStorage === true && window.sessionStorage && window.sessionStorage.getItem('myGeo')){
				_this.writeDebug('Using Session Saved Values for GEO');
				_this.autoGeocodeQuery(JSON.parse(window.sessionStorage.getItem('myGeo')));
				return false;
			}
			else if (navigator.geolocation) {
				navigator.geolocation.getCurrentPosition(function(position){
					_this.writeDebug('Current Position Result');
					// To not break autoGeocodeQuery then we create the obj to match the geolocation format
					var pos = {
						coords: {
							latitude : position.coords.latitude,
							longitude: position.coords.longitude,
							accuracy : position.coords.accuracy
						}
					};

					// Have to do this to get around scope issues
					if (_this.settings.sessionStorage === true && window.sessionStorage) {
						window.sessionStorage.setItem('myGeo',JSON.stringify(pos));
					}

					// Callback
					if (_this.settings.callbackAutoGeoSuccess) {
						_this.settings.callbackAutoGeoSuccess.call(this, pos);
					}

					_this.autoGeocodeQuery(pos);
				}, function(error){
					_this._autoGeocodeError(error);
				});
			}
		}
1258521
function(callback) {
            if(typeof opts !== "object") return callback();

            defOpts = Object.merge(defOpts, opts);
            for(var key in defOpts) {
                if(!defOpts.hasOwnProperty(key)) continue;
                switch(key) {
                case "mkdir": header.mkdir = defOpts.mkdir; break;
                case "md5": {
                    if(!md5) break;
                    if(typeof defOpts.md5 === "string" && 32 === defOpts.md5.length) {
                        header["content-md5"] = defOpts.md5;
                        break;
                    }
                    header["content-md5"] = md5(rawData);
                    break;
                }
                case "secret": header["content-secret"] = defOpts.secret; break;
                case "mime": header["content-type"] = defOpts.mime; break;
                default: break;
                }
            }

            callback();
        }
168705
public static GeocodingApiRequest geocode(GeoApiContext context, String address) {
    GeocodingApiRequest request = new GeocodingApiRequest(context);
    request.address(address);
    return request;
  }
3911
function forwardGeocode(address, callback) {
    var geocoder = new window.google.maps.Geocoder();
    var payload = {address: address};
    geocoder.geocode(payload, callback);
  }
1188557
def address_inline(request, prefix="", country_code=None, template_name="postal/form.html"):
    
    
    country_prefix = "country"
    prefix = request.POST.get('prefix', prefix)
    
    if prefix:
        country_prefix = prefix + '-country'
    
    country_code = request.POST.get(country_prefix, country_code)
    form_class = form_factory(country_code=country_code)
    
    if request.method == "POST":
        data = {}
        for (key, val) in request.POST.items():
            if val is not None and len(val) > 0:
                data[key] = val
        data.update({country_prefix: country_code})
        
        form = form_class(prefix=prefix, initial=data)
    else:
        form = form_class(prefix=prefix)
        
    return render_to_string(template_name, RequestContext(request, {
        "form": form,
        "prefix": prefix,
    }))
447689
def reverse_geocode(self, lat, lng, **params):
        
        return self._get_geocoder_result(latlng="%s,%s" % (lat, lng), **params)
1247345
def encode_location(location: BioCLocation):
    """"""
    return etree.Element('location',
                         {'offset': str(location.offset), 'length': str(location.length)})
620652
def address(lat, lng, *, raw=False):
    
    try:
        lat, lng = wgs_to_gk4(lat, lng)
        r = requests.get(
            url='https://www.dvb.de/apps/map/address',
            params={
                'lat': lat,
                'lng': lng,
            },
        )
        if r.status_code == 200:
            response = json.loads(r.content.decode('utf-8'))
        else:
            raise requests.HTTPError('HTTP Status: {}'.format(r.status_code))
    except requests.RequestException as e:
        print('Failed to access DVB map address app. Request Exception', e)
        response = None

    if response is None:
        return None
    return response if raw else process_address(response)