有没有一种方法可以根据一系列GPS坐标以编程方式确定最佳Bing地图缩放级别? [英] Is there a way to programmatically determine the optimal Bing Maps Zoom Level based on an array of GPS Coordinates?

查看:58
本文介绍了有没有一种方法可以根据一系列GPS坐标以编程方式确定最佳Bing地图缩放级别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以编程方式将一系列GPS坐标添加到Bing地图时,我想将缩放"级别设置为最佳-以显示每个图钉/位置,但只是勉强".

When programmatically adding an array of GPS Coordinates to a Bing Map, I want to set the Zoom level to the optimal - to show every pushpin/location, but "just barely."

我想做到这一点的一种方法是识别在坐标数组中找到的基本方向上最远的点,然后计算需要显示多少东西才能同时显示东西方向和南北方向

I imagine a way to do this would be to identify the furthest points in the cardinal directions found within the array of coordinates, and then calculate how many miles you need to display both east-to-west and north-to-south.

例如,假设北部和南部最远的位置被确定为彼此相距四十英里,而东部和西部最远的位置被确定为相距六十英里.是否有经验法则/计算法/算法确定最放大"的规则?级别将是显示所有位置/坐标,并带有离群值"尽可能靠近地图显示部分的边缘?

For example, let's say the furthest north and furthest south locations are determined to be forty miles distant from each other, and the furthest east and furthest west locations are determined to be sixty miles apart from each other. Is there a rule of thumb/calculation/algorithm that would determine what the most "zoomed-in" level would be that would display all of the locations/coordinates, with the "outliers" being as close to the edge of the displayed portion of the map as possible?

推荐答案

您可以设置带有边界框的地图视图,该边界框将自动确定缩放级别.看到这里的例子 https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk/setmapviewoptions 使用此处记录的Bounds属性 https://docs.microsoft.com/en-us/bingmaps/v8-web-control/map-control-api/viewoptions-object

You can set a map view with a bounding box, which will automatically determine the zoom level. See the example here https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk/setmapviewoptions using the Bounds property as documented here https://docs.microsoft.com/en-us/bingmaps/v8-web-control/map-control-api/viewoptions-object

这篇关于有没有一种方法可以根据一系列GPS坐标以编程方式确定最佳Bing地图缩放级别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆