Locate users by IP address
IP geolocation is a feature that identifies a visitor’s approximate location based on their IP address. This makes it possible to customize the map, website or application for your users based on where they are. The service is designed with security in mind and doesn’t collect or store user data.
How it works
IP geolocation retrieves location (country, region, city) from specialized IP-to-geolocation databases. It relies solely on the IP address, so it’s good to keep in mind that the process won’t work correctly if the real IP address is masked – for example when visitors use VPNs, proxies, or mobile ISPs.
How to integrate
Our IP geolocation service is available via the Geolocation API. The API page explains how to get geolocation programmatically and which libraries you can use, and provides complete API reference.
Use cases
Our code examples show how you can use geolocation for various needs. See most popular options here:
Show user’s location
Using IP geolocation, you can automatically center a map to the visitor’s location. If they’re at home, they’ll see a familiar area, and if travelling, they can find their way around faster. 👉 How to center a map on visitor’s location
Use local language
MapTiler maps can be manually set to show labels in virtually any language. Take this a step further by setting the language automatically based on visitor’s current location. 👉 How to change the map language based on visitor’s location
Customize cookies
IP geolocation can help display cookie information dynamically, for example, show the consent bar to visitors located in the European Union where it is required by law. 👉 How to display the cookies consent bar based on visitor’s location
Set disputed borders
Some areas of the world face territorial disputes that often make it unclear what the correct country borders are. The topic can be quite sensitive, so it’s a good idea to configure your map to show the borders based on how each involved country sees them. 👉 How to automatically change disputed borders based on visitor’s country