5

Is there any way to retrieve latitude and longitude using this type of google map link?

https://goo.gl/maps/7jNqZtPa5Cjf333k7

In this URL 7jNqZtPa5Cjf333k7 is not referring to place id right? I'm really struggling to extract latitude and longitude using this type of link. Really appreciate your help if somebody can give me an idea. Or else retrieving the place id also can be a help for me so I can use the link like this to retrieve the response in a JSON format.

https://maps.googleapis.com/maps/api/geocode/json?place_id=7jNqZtPa5Cjf333k7&key=YOUR_API_KEY
2
  • Related question: Google Maps URL expanding - Missing Lat Lon
    – geocodezip
    Commented Jul 3, 2022 at 18:27
  • In your given URL, the location (latitude, longitude) is the one after the @ character, which is 6.8391224,80.0308563. Next, you cannot get a place ID in Google Maps web app. This is because Google Maps web app (maps.google.com) and Google Maps APIs are two different products.
    – Beth
    Commented Jul 6, 2022 at 7:04

1 Answer 1

3

There is no way to decode it without following the redirection.

That link redirects to: https://www.google.com/maps/place/Kandanawatta,+Sri+Lanka/@6.8391224,80.0308563,17z/data=!3m1!4b1!4m5!3m4!1s0x3ae2523ff96d8abf:0x4a6d8d4b68830686!8m2!3d6.8391224!4d80.0308563?hl=en-US

To decode the information in that link, see related questions:

The latitude and longitude for the location in that link is:

8m2!3d6.8391224!4d80.0308563
6.8391224,80.0308563

For Kandanawatta, Sri Lanka, the Google Places API returns:

Kandanawatta, Sri Lanka (6.837274799999999, 80.0325338)

Which is not quite the same, hard to say why without knowing where you got the "shortened" URL from.

The coordinates at the beginning (following the @):

6.8391224,80.0308563,17z

Are the center and zoom level of the map, not necessarily the location in the original request

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.