Creating Links to Locations in Google Maps and Apple Maps

Knowing how to create map links can be incredibly useful, whether you're sharing a meeting point with friends or adding location links to your website. This guide covers different methods for linking to locations in Google Maps and Apple Maps.

Using Coordinates

If you have exact coordinates, you can create precise location links.

Google Maps Coordinate Links

https://www.google.com/maps?q=LATITUDE,LONGITUDE

For example, linking to the Eiffel Tower:

https://www.google.com/maps?q=48.8584,2.2945

Apple Maps Coordinate Links

https://maps.apple.com/?ll=LATITUDE,LONGITUDE

The same Eiffel Tower location:

https://maps.apple.com/?ll=48.8584,2.2945

Using Search Queries

Don't have exact coordinates? No problem!

Both mapping services support search queries.

Google Maps Search Links

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

Example:

https://www.google.com/maps/search/?api=1&query=Eiffel+Tower+Paris

Apple Maps Search Links

https://maps.apple.com/?q=SEARCH_QUERY

Example:

https://maps.apple.com/?q=Eiffel+Tower+Paris

Additional Options

Both services support extra parameters to customize the viewing experience:

Google Maps

  • Add zoom level: &z=ZOOM_LEVEL (1-20)
  • Example with zoom: https://www.google.com/maps?q=48.8584,2.2945&z=15

Apple Maps

  • Set zoom level: &z=ZOOM_LEVEL (1-20)
  • Switch to satellite view: &t=k
  • Example with both: https://maps.apple.com/?ll=48.8584,2.2945&z=15&t=k

URL Encoding

If you are building these things into an app, it's easy to properly encode URLs to handle special characters and spaces. Here's how to do it with JavaScript:

// Basic usage
const searchQuery = "Eiffel Tower, Paris";
const encodedQuery = encodeURIComponent(searchQuery);
const googleMapsUrl = `https://www.google.com/maps/search/?api=1&query=${encodedQuery}`;

// Examples of encoding results:
const examples = {
  "Café & Bar": "Caf%C3%A9%20%26%20Bar",
  "123 Main St, New York": "123%20Main%20St%2C%20New%20York",
  "Pike Place Market, Seattle": "Pike%20Place%20Market%2C%20Seattle"
};

// Function to create map links
function createMapLinks(location) {
  const encoded = encodeURIComponent(location);
  return {
    google: `https://www.google.com/maps/search/?api=1&query=${encoded}`,
    apple: `https://maps.apple.com/?q=${encoded}`
  };
}

// Usage example:
const links = createMapLinks("Eiffel Tower, Paris");
console.log(links);
/* Output:
{
  google: "https://www.google.com/maps/search/?api=1&query=Eiffel%20Tower%2C%20Paris",
  apple: "https://maps.apple.com/?q=Eiffel%20Tower%2C%20Paris"
}
*/
  • Don't manually replace spaces with + or %20 - let the encoding function handle it
  • Always encode the query/location portion of the URL, not the entire URL
  • Test encoded URLs with various special characters and international place names

Hopefully this has made your location sharing easier.

MapsJavaScript
Avatar for Niall Maher

Written by Niall Maher

Founder of Codú - The web developer community! I've worked in nearly every corner of technology businesses: Lead Developer, Software Architect, Product Manager, CTO, and now happily a Founder.

Loading

Fetching comments

Hey! 👋

Got something to say?

or to leave a comment.