To open decimal coordinates in a map, build a service-specific HTTPS URL with latitude first and longitude second, then place it in a regular link. Google Maps needs api=1 and a query parameter; Apple Maps accepts a coordinate pair; OpenStreetMap can use marker parameters and a map fragment for its center and zoom. JavaScript’s URL and URLSearchParams handle query-string encoding for you.
Validate the coordinates before making a link
Use decimal degrees in latitude,longitude order. Keep negative signs: a negative latitude is south of the equator, and a negative longitude is west of the prime meridian. For example, 37.422 and -122.084 represent latitude 37.422 and longitude -122.084.
As an Amazon Associate I earn from qualifying purchases.
Check that both values are finite numbers and within geographic bounds before building a URL:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
- Latitude: -90 through 90.
- Longitude: -180 through 180.
function validateCoordinates(lat, lon) {
if (!Number.isFinite(lat) || !Number.isFinite(lon)) {
throw new TypeError("Latitude and longitude must be finite numbers.");
}
if (lat < -90 || lat > 90) {
throw new RangeError("Latitude must be between -90 and 90.");
}
if (lon < -180 || lon > 180) {
throw new RangeError("Longitude must be between -180 and 180.");
}
}
These checks prevent invalid coordinate values; they are geographic bounds, not a guarantee that a mapping service has a named place or feature at that point.
#1 Best Overall
- Bright, high-resolution 5” glass capacitive touchscreen display lets you easily view your route
- Get more situational awareness with alerts for school zones, speed changes, sharp curves and more
- View food, fuel and rest areas along your active route, and see upcoming cities and milestones
- View Tripadvisor traveler ratings for top-rated restaurants, hotels and attractions to help you make the most of road trips
- Directory of U.S. national parks simplifies navigation to entrances, visitor centers and landmarks within the parks
Build a Google Maps coordinate link
For a coordinate pin, use Google’s Maps search URL with api=1 and a comma-separated latitude,longitude query. Google says api=1 is required for every Maps URL request; without it, the parameters are ignored and the default map opens. Its documentation also says to encode URLs properly and sets a 2,048-character limit per request. See Google Maps URLs: Get Started.
function googleMapsUrl(lat, lon) {
validateCoordinates(lat, lon);
const url = new URL("https://www.google.com/maps/search/");
url.searchParams.set("api", "1");
url.searchParams.set("query", `${lat},${lon}`);
return url.toString();
}
const link = googleMapsUrl(37.422, -122.084);
// https://www.google.com/maps/search/?api=1&query=37.422%2C-122.084
A coordinate-only search places a pin but does not provide additional place information. If the link must identify a particular establishment, Google supports adding a known query_place_id alongside the query.
Rank #2
- 6” high-resolution navigator includes map updates of North America
- Hands-free calling when paired with your compatible smartphone with BLUETOOTH technology and convenient Garmin voice assist lets you ask for directions to places you want to go
- Road trip–ready features include the HISTORY database of notable sites, a U.S. national parks directory, Tripadvisor traveler ratings and millions of Foursquare POIs
- Driver alerts for things such as school zones, sharp curves and speed changes help encourage safer driving and increase situational awareness
- Access live traffic, fuel prices, parking, weather and smart notifications when you pair this navigator with your compatible smartphone running the Garmin Drive app
Use a directions URL when the goal is a route
A search link and a directions link do different things. To request directions to a coordinate, use destination instead of query; Google allows the origin to be omitted.
function googleDirectionsUrl(lat, lon) {
validateCoordinates(lat, lon);
const url = new URL("https://www.google.com/maps/dir/");
url.searchParams.set("api", "1");
url.searchParams.set("destination", `${lat},${lon}`);
return url.toString();
}
With no origin supplied, Google may use a relevant current location or show a blank directions form. The exact result depends on the context in which the URL is opened. The parameter format is documented in Google’s Maps URLs guide.
Rank #3
- Explore confidently with the reliable handheld GPS
- 2.2” sunlight-readable color display with 240 x 320 display pixels for improved readability
- Preloaded with Topo Active maps with routable roads and trails for cycling and hiking
- Support for GPS and GLONASS satellite systems allows for tracking in more challenging environments than GPS alone
- 8 GB of internal memory for map downloads plus a micro SD card slot
Build an Apple Maps coordinate link
Apple’s unified Maps URL documentation describes coordinate as a comma-separated latitude,longitude pair and supports coordinate-based map display and directions. The archived Map Links reference documents the ll parameter for a latitude,longitude pair. This map-display example uses ll:
function appleMapsUrl(lat, lon) {
validateCoordinates(lat, lon);
const url = new URL("https://maps.apple.com/");
url.searchParams.set("ll", `${lat},${lon}`);
return url.toString();
}
const link = appleMapsUrl(37.422, -122.084);
Apple’s unified URL documentation also describes coordinate-based directions using source and destination, either of which may be a coordinate. Consult Apple’s unified Maps URLs documentation and archived Map Links reference for the URL formats.
Rank #4
- 8” navigator with high-resolution, dual-orientation display and map updates of North America .Special Feature:Large Display; Voice Assist; Hands-Free Calling; Live Traffic and Weather; Traffic Cams and Parking; Smart Notifications,Driver Alerts; Tripadvisor; National Parks Directory; Find Places by Name; Garmin Real Directions Feature.
- Hands-free calling when paired with your compatible smartphone with BLUETOOTH technology and convenient Garmin voice assist lets you ask for directions to places you want to go
- Road trip–ready features include the HISTORY database of notable sites, a U.S. national parks directory, Tripadvisor traveler ratings and millions of Foursquare POIs
- Driver alerts for things such as school zones, sharp curves and speed changes help encourage safer driving and increase situational awareness
- Access live traffic, fuel prices, weather, parking and smart notifications when you pair this navigator with your compatible smartphone running the Garmin Drive app
Build an OpenStreetMap link with a marker and zoom
OpenStreetMap’s website can center the map with a URL fragment in the form #map=ZOOM/LAT/LON. The mlat and mlon query parameters set a red marker. Use the same coordinates for the marker and the center so that the marker is in the visible map area.
function openStreetMapUrl(lat, lon, zoom = 16) {
validateCoordinates(lat, lon);
if (!Number.isInteger(zoom) || zoom < 0) {
throw new RangeError("Zoom must be a non-negative integer.");
}
const url = new URL("https://www.openstreetmap.org/");
url.searchParams.set("mlat", String(lat));
url.searchParams.set("mlon", String(lon));
url.hash = `map=${zoom}/${lat}/${lon}`;
return url.toString();
}
The fragment is separate from the query string, so the code sets it directly and retains its documented slash separators. OpenStreetMap’s Browsing wiki documents this format and cautions that URL parameter support may change. It also notes that a marker can sit outside the visible map when the map center differs from the marker position.
Best Value
- Bright, high-resolution 5” glass capacitive touchscreen display lets you easily view your route
- Get more situational awareness with alerts for school zones, speed changes, sharp curves and more
- View food, fuel and rest areas along your active route, and see upcoming cities and milestones
- View Tripadvisor traveler ratings for top-rated restaurants, hotels and attractions to help you make the most of road trips
- Directory of U.S. national parks simplifies navigation to entrances, visitor centers and landmarks within the parks
Offer the links as ordinary anchors
Once the URL is built, assign it to an HTTPS anchor. This gives the browser a standard link to handle rather than assuming a particular app is installed.
const lat = 37.422;
const lon = -122.084;
googleLink.href = googleMapsUrl(lat, lon);
appleLink.href = appleMapsUrl(lat, lon);
osmLink.href = openStreetMapUrl(lat, lon, 16);
In HTML, the resulting links can be rendered as <a href="...">Open in Google Maps</a> and corresponding Apple Maps and OpenStreetMap anchors. Do not promise that a link will always launch a native app: browser, operating system, user settings, and installed apps affect whether the destination opens in a browser or app. Google documents custom URL schemes for app-specific iOS behavior, but recommends checking app availability; for a web page, its universal HTTPS Maps URLs have broader platform handling. See Google Maps URL Scheme for iOS.
Quick Recap
Coordinate order and link behavior at a glance
| Service | Coordinate link format | What it does |
|---|---|---|
| Google Maps | https://www.google.com/maps/search/?api=1&query=LAT%2CLON |
Searches the coordinate and places a pin. |
| Apple Maps | https://maps.apple.com/?ll=LAT%2CLON |
Opens a map at the coordinate. |
| OpenStreetMap | https://www.openstreetmap.org/?mlat=LAT&mlon=LON#map=ZOOM/LAT/LON |
Sets a red marker and map center with a chosen zoom. |
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




