Search code examples
google-mapsgoogle-maps-urls

Google maps universal URL error


Using the Google Maps universal cross-platform URL, I want maps to point to a specified location.

The search action displays results for a search across the visible map region. When searching for a specific place, the resulting map puts a pin in the specified location and displays available place details.

Using maps web interface, I pick a point on map, for instance with coordinates [49.258786662320986,-123.0241870880127]. These are valid coordinates which will point map to existing location when searched from Google maps web interface:

enter image description here

The same coordinates in the query

https://www.google.com/maps/search?api=1&query=49.258786662320986,-123.0241870880127

will result in error 404.

Why valid geo coordinates from Google web interface not working in Google Universal URL API?


Solution

  • I've just noticed that in the official documentation the URL is

    https://www.google.com/maps/search/?api=1&parameters

    Note a / symbol after /search and before ?api=1. Once I added this missing / in your sample URL, the 404 disappeared

    https://www.google.com/maps/search/?api=1&query=49.258786662320986,-123.0241870880127

    Not sure if this behavior is intentional though.