Geolocation - API Client JS
MapTiler API Client JS geolocation function provides an accurate location of a website visitor using its IP address.
Obtain information about visitor’s location based on the IP address of an incoming request.
// in an async function, or as a 'thenable':
const result = await maptilerClient.geolocation.info();
Parameters
options.apiKey | Custom MapTiler API key to use instead of the one in global config .
|
---|
Response
Returns a geolocation result object
{
"country_code": "CZ",
"country": "Czech Republic",
"country_bounds": [12.091575, 48.551911, 18.859266, 51.055384],
"country_languages": ["cs"],
"continent": "Europe",
"continent_code": "EU",
"eu": true,
"city": "Brno",
"latitude": 49.19522,
"longitude": 16.60796,
"postal": "602 00",
"region": "South Moravian",
"region_code": "64",
"timezone": "Europe/Prague",
"elevation": 214.89999389648438
}
Read more about geolocation on our official API documentation.