Get latitude and longitude from google map share link using php
Get the solution ↓↓↓Solution:
var url = 'https://www.google.co.in/maps/place/RAKBANK/@25.1120342,55.3745323,15z/data=!4m12!1m6!3m5!1s0x0:0x358ae5fd319e6a64!2sSemmer+Villas!8m2!3d25.1151977!4d55.3821136!3m4!1s0x0:0x3fdded92629b7214!8m2!3d25.1131947!4d55.3759586';
var urlParts = url.split( '/' );
var getLatLng = urlParts[6].replace('@','');
getLatLng = getLatLng.split( ',' );
var geo = {
lat: getLatLng[0],
lng: getLatLng[1]
}
console.log(geo);
Is this what you want? It will only grab the Lat and Lng for the Map Center which is enclosed in the URL.
If you are looking for the Location of RAKBANK, you would need to use Google Geolocation to return the Address and/or lat lng.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: xml parsing error: no root element found
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.