Google Map URLs

Google Map URLs

A universal, cross-platform URL for Google Maps

Cover Photo by Yucel Moran on Unsplash

Introduction

You can create a global, cross-platform URL to open Google Maps and perform searches, receive directions and navigation, and display map views and panoramic photos using Maps URLs. Regardless of the platform, the URL syntax is the same.

I first started using this handy feature of Google Maps for a college project of mine. And I found it very helpful. All you have to do is open a URL with a few parameters passed, and voila - You have your very own deeplink-ish Google Maps.

The best part is that you don't need a Google API key to use Maps URLs.

In this article, we will discuss a few examples of Google Map URLs.

How will this URL behave?

As a developer of an Android app, an iOS app, or a website, you may create a common URL that will launch Google Maps and execute the required action regardless of the platform used to access the map.

On an Android device:

  • The URL starts Google Maps and performs the desired action if the Google Maps app for Android is installed and running.
  • If Google Maps is not installed or is disabled, the URL launches Google Maps in a browser and performs the requested action.

On an iOS device:

  • The URL starts Google Maps and performs the desired action if the Google Maps app for iOS is installed and running.
  • If Google Maps is not installed or is disabled, the URL launches Google Maps in a browser and performs the requested action.

On any other device, the Map URL opens Google Maps in a browser and performs the required action.

Type of actions available

  • Search - start a Google Map with a pin for a specific location, or conduct a general search and open a map to display the results.: https://www.google.com/maps/search/?api=1&parameters

  • Directions - request for directions and launch Google Maps with the results: https://www.google.com/maps/dir/?api=1&parameters

  • Display a map - launch Google Maps with no markers or directions: https://www.google.com/maps/@?api=1&map_action=map&parameters

  • Display a Street View panorama - launch Google Maps with an interactive panorama image: https://www.google.com/maps/@?api=1&map_action=pano&parameters

Examples

Example 1

Search for a place with only latitude and longitude https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393

1_D-EZlglhogn7gLGzOPl3kQ.png Source: Google Note: There is a pin in the map, but no additional place information is provided on the map or in the side panel. This is because the location is fetched only with the coordinates.

Example 2

Search with a place name https://www.google.com/maps/search/?api=1&query=centurylink+field

1_fads-mJ_0cfhyyhE8xecfw.png

Directions

Example 1

Launch a map with walking directions from Google in Sydney, Australia, to the Queen Victoria Building.

https://www.google.com/maps/dir/?api=1&origin=Google+Pyrmont+NSW&destination=QVB&destination_place_id=ChIJISz8NjyuEmsRFTQ9Iw7Ear8&travelmode=walking

1_8exov8Kag2P5rFIp6mXdAA.png

Conclusion

There are a lot of different parameters that can be passed into these queries, and I highly suggest you visit the documentation and read them.

Happy Learning.

Resources