1
我使用下面的代码在Google地图上(android API v2)以5度的间隔绘制一堆垂直线。所有的作品都很好,直到缩小到近似缩放级别5.1,此时所有的线条都消失了。这是我的代码中的一个错误,或者是地图API有意做的事情?我怎样才能让这些线出现在所有的缩放比例?当缩小时,android地图上的折线消失
非常感谢。
if (gMap != null) {
double lat = loc_service.getLatitude();
double lng = loc_service.getLongitude();
LatLngBounds bounds = new LatLngBounds(new LatLng(lat-(MAP_WIDTH/2), lng-(MAP_WIDTH/2)), new LatLng(lat+(MAP_WIDTH/2), lng+(MAP_WIDTH/2)));
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, 720, 720, 0);
gMap.setMyLocationEnabled(true);
gMap.moveCamera(cu);
// initialize the time marker AT ONE MINUTE INTERVALS
time_markers = new ArrayList<Polyline>();
// calculate distance to zero-second mark
double offset = getLngOffset();
for (int i=-MARK_RNG; i<MARK_RNG; i++) {
PolylineOptions plOptions = new PolylineOptions()
.add(new LatLng(90, (lng-offset + (i*5))))
.add(new LatLng(-90, (lng-offset + (i*5))))
.width(2)
.color(Color.BLUE);
time_markers.add(gMap.addPolyline(plOptions));
}
}
您的85/-85修复完成了这项工作 - 谢谢。也许90/-90超出投影范围(我记得在地图上看到地图本身只能达到+/- 85度的纬度)。我会将我的问题添加到bug报告中,希望得到答案。 – user2650541