Direct coordinate URL forms
Copy
Ask AI
import { parseGoogleMapsUrl } from "google-maps-link-parser";
const urls = [
"https://www.google.com/maps/@24.7136,46.6753,15z",
"https://maps.google.com/?q=24.861307,46.646618",
"https://www.google.com/maps?ll=24.7136,46.6753",
"https://www.google.com/maps/place/24.7136,46.6753",
"https://www.google.com/maps/data=!3d24.7136!4d46.6753",
];
for (const url of urls) {
const result = parseGoogleMapsUrl(url);
console.log([result.location.value?.latitude, result.location.value?.longitude]);
}
Copy
Ask AI
[24.7136, 46.6753]
[24.861307, 46.646618]
[24.7136, 46.6753]
[24.7136, 46.6753]
[24.7136, 46.6753]
Street View and map actions
Copy
Ask AI
const result = parseGoogleMapsUrl(
"https://www.google.com/maps?map_action=pano&viewpoint=24.7136,46.6753&pano=test-pano",
);
console.log(result.intent); // => "streetview"
console.log(result.mapView.value?.panoId); // => "test-pano"