CosmoCode is a Berlin based IT service provider focusing on CMS, Wikis and Web2.0
Great software. Bright people. Happy customers!
Mail info@cosmocode.deTel +49 (30) 814504070
Using a bounding box in a Google Maps environment has certain advantages over operating only on geo points.
One of its biggest advantages is to capture the current map section without the need to worry about the zoom level.
Unfortunately, the Google Maps API in Android is not laid out to be used with a bounding box like you would expect as a Javascript API user - but it still can be put to good use.
You can use the map view projection to calculate the bounding box:
Projection projection = mMapView.getProjection(); // Get the point in the north west corner GeoPoint nw = projection.fromPixels(0, 0); // and the one in the lower left corner GeoPoint se = projection.fromPixels(mapView.getWidth(), mapView.getHeight()); Integer north = nw.getLatitudeE6(); Integer south = se.getLatitudeE6(); Integer east = se.getLongitude(); Integer west = nw.getLongitude();
Thanks to Dominik
About CosmoCode
Subscribe