Reputation: 309
I want to do something like aerophotography simulator as my university project, using Google Maps Api. For this, I need dynamically change viewport of a map, but for this I have to get lat and long of center of my viewport. Is there any way to do that, using Google Maps Api standart functions?
Upvotes: 0
Views: 261
Reputation: 4848
In order to get the coordinates (LatLng) associated with the center point (x,y) of the MapView you can use the method getCameraPosition()
.
(Assuming your GoogleMap
object is mMap)
LatLng latLng = mMap.getCameraPosition().target;
In order to animate the camera position use the method animateCamera()
, something like this:
mMap.animateCamera(location);
where location is the next location you wish to show on the map (LatLng
object).
Upvotes: 2