Snow Innocent
Snow Innocent

Reputation: 147

How can I get position in google map?

I want to find position of location(with latitude and longitude).

I try to get the (latitude, longitude) of left-top and right-bottom points of map and lerp to calculate the position.

However, I don't know coordinate of left-top and right-bottom points. How can I get or calculate them?

Upvotes: 0

Views: 818

Answers (2)

LordRaydenMK
LordRaydenMK

Reputation: 13321

You are looking for the VisibleRegion class.

From a MapFragment you can use:

VisibleRegion visibleRegion = getMap().getProjection().getVisibleRegion();

Upvotes: 0

Teo Inke
Teo Inke

Reputation: 5986

Center:

map.getCameraPosition().target;

Bounds:

LatLngBounds curScreen = map.getProjection().getVisibleRegion().latLngBounds;

Where you then access left-top and right-bottom points using:

curScreen.northeast

and

curScreen.southwest

Upvotes: 2

Related Questions