You are here

public function IpGeoLocAPI::getAddress in IP Geolocation Views & Maps 8

Returns the formatted address reverse-geocoded from the supplied lat,long.

See the CALLER BEWARE note at ip_geoloc_reverse_geocode().

Parameters

mixed $latitude: E.g. "-37.87" or -37.87.

mixed $longitude: E.g. "144.98" or 144.98.

string $lang: Optional language specification as a two-letter code, e.g. 'ja' (Japanese).

Return value

string Formatted address component as received from Google or empty string.

File

src/Services/IpGeoLocAPI.php, line 488

Class

IpGeoLocAPI
Class IpGeoAPI to interact with other modules.

Namespace

Drupal\ip_geoloc\Services

Code

public function getAddress($latitude, $longitude, $lang = NULL) {
  return $google_address = $this
    ->reverseGeocode($latitude, $longitude, $lang) ? $google_address['formatted_address'] : '';
}