如何在“地图视图”上设置合适的缩放级别?
mMapController.animateTo(mAllSpots.get(0));
mMapController.setCenter(mAllSpots.get(0));
mMapController.setZoom(getZoomSize(mAllSpots));
有 11 个不同的点,我想在“地图视图”上显示它们,同时,我想在“地图视图”上看到所有 11 个点。那么合适的缩放级别是多少?谢谢。
mMapController.animateTo(mAllSpots.get(0));
mMapController.setCenter(mAllSpots.get(0));
mMapController.setZoom(getZoomSize(mAllSpots));
There are 11 different points and I want to show them on the 'mapview',meanwhile,I want to see all of the 11 points on the 'mapview' .So what is the appropriate zoom level? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能应该使用 ItemizedOverlay 实现来展示您的观点。如果您这样做,您还可以使用这些方便的方法来为您完成所有工作:
You should probably be using an ItemizedOverlay implementation to show your points. If you do, you can also use these handy methods to do all the work for you:
这 1 代表点到意味着在给定参数的特定/定义位置上平移地图,
这 1 代表基于给定参数作为位置值的居中地图,
这 1 代表设置缩放级别,您需要
在此处 使用此方法latSpan 和 longSpan 是由 maxlat-minlat 和 maxlng - minlng 定义的,首先你需要找到 minlat,minlng 和 maxlat,maxlng 然后将其添加到你必须传入的值中这,这将作为缩放,动画,居中一起
编辑
你需要找到从地图视图中获取这将为你提供maplatspan,就像假设你的点一样,
现在获取minlat,minlng和maxlat,maxlng然后减去它,该点被绑定为矩形的矩形点,并找到该矩形的中心点
minlat = 20.212232,minlng = 68.802093,maxlat = 22.212232, maxlng = 68.889898
latspan = maxlat - minlat, lngspan = maxlng - minlng
您还需要转换为地理点以与 1e6 相乘,如 latspan*1e6 和 lngspan*1e6,现在传递给函数
this 1 is for the point to means pan the map on specific/define location as given argument,
this 1 is for centered map based on the given argument as location value
this 1 is for set the zoom level you need to use this method
here the latSpan and longSpan was define by maxlat-minlat and maxlng - minlng, first of all you need to find minlat,minlng and maxlat,maxlng and than sustract it whatever the value getting that you have to pass in this, this will work as zoom,animate, center together
Edited
you need to find to get from the mapview this will give you the maplatspan like suppose your points,
now get the minlat,minlng and maxlat,maxlng and then substract it, this point was bound rect point as rectangle and find as center point of this rectangle
minlat = 20.212232, minlng = 68.802093, maxlat = 22.212232, maxlng = 68.889898
latspan = maxlat - minlat, lngspan = maxlng - minlng
also you need to convert into the geopoint to multiply by with 1e6 like latspan*1e6 and lngspan*1e6 and now pass to the function