Google Maps Unshortener

A free public API that resolves map links to their coordinates: short links of Google Maps, Apple Maps, Waze, Yandex and other map services, and places of OpenStreetMap, Wikipedia and Wikidata. The server makes the requests to these services on your behalf: they see neither your address nor your device.

Usage

GET /unshortener?link=<link>, with the link URL-encoded. The text shared by a map app (place name followed by the link) is accepted too.

POST /unshortener/batch with {"links": [<link>, …]} resolves up to 20 links at once: one result per link, in their order, with its status.

GET /unshortener/place-list?link=<link> gives the places of a public Google Maps list.

Supported: Google Maps (maps.app.goo.gl, goo.gl/maps, g.co, g.page, share.google, Google's country domains), Apple Maps (maps.apple, apple.co, maps.apple.com), Waze (waze.com), Yandex Maps (Yandex's country domains, ya.cc, clck.ru), 2GIS and Urbi, Mapy.com, Amap, Baidu Map (links with coordinates), Bing Maps and MapQuest (places), OpenStreetMap elements (node, way, relation), Wikipedia articles and Wikidata items. Coordinates are always WGS84.

GET /search?q=<text>&lang=<language> finds places by name or address with OpenStreetMap's Nominatim, for a search the user asks for: never as they type.

JSON response example

{
    "full_link": "https://www.google.com/maps?q=48.8583701,2.2944813",
    "lat": 48.8583701,
    "long": 2.2944813,
    "name": "Tour Eiffel",
    "nominatim": false,
    "steps": 2,
    "timestamp": 1790759488
}
    

Read lat and long. name, the name of the place, is there when the provider gives one. points, for a route whose every stop is known, lists them in order. nominatim is true when the coordinates come from geocoding the address of the place (less precise). Errors are {"error": "…"} with status 400 (unsupported link), 429 or 503 (too many requests, or a map service too slow: wait Retry-After seconds) or 500 (the link could not be resolved).

Fair use

No API key. Each client address is limited to 30 requests per minute and 1000 per day on /unshortener, 10 per minute and 200 per day on /search, and answers are cached for a day. To resolve many links, send them by /unshortener/batch, where each link not cached still counts as a request, or run your own instance. The links, searches and coordinates you send are not written to the server logs.

Try it



Source Code | retiolus.net | Support me on Liberapay or Buy Me a Coffee