【发布时间】:2013-01-31 20:39:56
【问题描述】:
我的 Android 应用中有一个 MapFragment,现在我想知道实际地图上显示的最小和最大纬度/经度。
我找到了这个解决方案:
如果您想找出 MapView 角落的经度纬度,您可以使用:
Point mapCenter = mapView.getMapCenter();
int latitudeSpan = mapView.getLatitudeSpan() / 2;
int longitudeSpan = mapView.getLongitudeSpan() / 2;
int topLeftLat = mapCenter.getLatitudeE6() + (latitudeSpan);
int topLeftLon = mapCenter.getLongitudeE6() - (longitudeSpan);
int bottomLeftLat = mapCenter.getLatitudeE6() - (latitudeSpan);
int bottomLeftLon = mapCenter.getLongitudeE6() + (longitudeSpan);
我现在的问题是我没有 MapView, 我只有一个 GoogleMap (com.google.android.gms.maps.GoogleMap) 和一个 MapFragment (com.google.android.gms.maps.MapFragment)。
我需要最小/最大坐标来执行数据库查询以选择 POI-DB-Entrys。
【问题讨论】:
标签: android android-mapview google-maps-android-api-2 mapfragment