suresh cheemalamudi suresh cheemalamudi - 1 month ago 5
Android Question

Android - how to get map co ordinates from map view

In my application i am displaying places using markers on google maps. But i am marking all the available places at once which i dont want to do. I wanted to display the places which only fits into the screen by fetching the maps co ordinates as shown below.

enter image description here

I wanted only to fetch the places that are available in this range from the source by sending the co ordinates of the maps. I am not sure whether i should capture all the 4-co ordinates from the corners of the screen? can anyone help me to figure out this?

Answer

You can get those by using this method:

    yourMapView.getMap().getCameraPosition();

This returns you a CameraPosition object. The coordinates of the camera is given by the field target and the zoom level by the field zoom. Now you should be able to calculate the aproximate coordinates of the screen corners.

Comments