Reputation: 2173
I'm using Google Maps Javascript Web API. I'm looking to get the current location (GPS coordinates) of the view. Meaning, if I drag the map all the way to England, the function would return the GPS coordinates of the view's center (which would be somewhere in England).
How can it be accomplished? Is there a certain function I can use?
Upvotes: 0
Views: 162
Reputation: 21475
Try getCenter()
:
let map = new google.maps.Map(document.getElementById('map'), { ... }),
currentLocation = map.getCenter();
Upvotes: 1