Freeze the area currently displayed in Android MapView

Possible duplicate:
How to determine if geo-information is displayed in the viewing area?

Is there any effective way by which I can find out how many areas (in terms of Geo points) my map display is displayed relative to the current zoom level?

As in geometry, we know that the top left can start with (0,0), and the bottom right can end with (320,480), is there some way that I can know that the current top left GeoPoint is, (76.3213.54.5678), and the lower right (112.2345, 132.4567)?

Ultimately, I would like to query a database to send me information related to GeoLocations, larger than the start point and smaller than the end point.

+3
source share
2 answers

There are several ways to do this:

One, use MapView.getProjection()that allows you to convert between screen coordinates and geographical points.

Two, use a combination MapView.getMapCenter(), MapView.getLatitudeSpan()and MapView.getLongitudeSpan()and do a little math. The first option sounds better in your case, but your mileage may vary.

In any case, the MapView document is in full here.

+1
source

Using

 mapview.getTop(), mapview.getBottom(), mapview.getLeft(), mapview.getRight() 

to get the position of the edge of the map. Then using

mapView.getProjection().fromPixels(x, y);

to get the coordinates. When you have this corrdinates, save it to the database and query them simply.

+1
source

All Articles