寻找圆周内的所有链接和边的方法是什么?

huangapple go评论62阅读模式
英文:

how to find all links and edges in within a circumference?

问题

I can help you with the translation of the code-related part. Here's the translated code:

在 openstreetmapX.jl 包中如何查找距离某一点 12-5 英里范围内的所有节点以及如何在地图网络上绘制边界

例如这是地图数据

```julia
using OpenStreetMapX
# 您可以将下面的行替换为表示另一个 OSM 地图文件路径的字符串。
map_file_path = joinpath(dirname(pathof(OpenStreetMapX)), "test/data/reno_east3.osm")
mx = get_map_data(map_file_path, use_cache=false)

如果 A=(纬度, 经度) 是地图内的随机坐标,如何:
1- 获取距离 A 1 公里内的所有节点和连接
2- 获取距离 A 2 到 5 公里内的所有节点和连接(不包括小于 1 公里的)
3- 在地图上绘制上述边界

在文档中有 mx.bounds,但它不用于查找特定节点的距离。是否有任何有用的命令?


Is there anything else you need regarding this translation?

<details>
<summary>英文:</summary>

In the openstreetmapX.jl package how to find all the nodes that are within in 1 and 2-5 miles of a certain points? And how to draw a boundary in a map network?

For example, this is the map data:

using OpenStreetMapX

you can replace the line below with a String representing another path to an OSM map file.

map_file_path = joinpath(dirname(pathof(OpenStreetMapX)),"..","test/data/reno_east3.osm")
mx = get_map_data(map_file_path, use_cache=false);


if `A=(lat,long)` be a random coordinate inside this map, how to:
1- have all the nodes and links within 1 km away of `A`
2- have all the nodes and links within 2 to 5 km away from `A` (not including those that are less than 1)
3- drawing above boundaries on the map

in the documentation there is `mx.bounds` but it is not for finding a distance from a particular node. Is there any useful command?


</details>


# 答案1
**得分**: 3

Suppose you have a node `140002490` in your example map. Then you can do:

所有节点在350米范围内(注意第二个向量包含的是米数):

```julia
julia&gt; nodes_within_driving_distance(mx,[140002490],350.0)
([3149568822, 1897440773, 140002490, 140293909], [336.19640743008256, 322.421892817634, 0.0, 300.2801993285697])

所有节点在15秒内(请注意,第二个参数包含驾驶时间):

julia&gt; nodes_within_driving_time(mx,[140002490],15.0)
([3149568822, 140293915, 3149568876, 1897440773, 140002490, 140293909], [12.103070667482973, 12.68859012113578, 14.95081063503372, 11.607188141434824, 0.0, 10.81008717582851])

如果您想计算欧几里得距离,请使用ENU坐标,这也是绘图的最佳选择。

例如,这将得到大约322,这是这些节点之间的距离(以米为单位):

distance(mx.nodes[140002490], mx.nodes[1897440773])

关于绘图,ENU坐标非常适合自己绘制图形(它们也被OpenStreetMapXPplot.jl使用)。如果您使用像folium这样的库,它会使用LLA坐标,在OpenStreetMapX教程中您可以找到如何将ENU坐标转换为LLA坐标的示例。

英文:

Suppose you have a node 140002490 in your example map.
Than you can do

All nodes within 350 meters (node the second vector contains distances in meters):

julia&gt; nodes_within_driving_distance(mx,[140002490],350.0)
([3149568822, 1897440773, 140002490, 140293909], [336.19640743008256, 322.421892817634, 0.0, 300.2801993285697])

All nodes within 15 seconds (note the second parameter contains driving times):

julia&gt; nodes_within_driving_time(mx,[140002490],15.0)
([3149568822, 140293915, 3149568876, 1897440773, 140002490, 140293909], [12.103070667482973, 12.68859012113578, 14.95081063503372, 11.607188141434824, 0.0, 10.81008717582851])

If you want to calculate an Euclidean distance use ENU coordinates which are also the best for plotting.

For an example this will yield approximately 322 which is the distance between those nodes in meters.

distance(mx.nodes[140002490], mx.nodes[1897440773])

Regarding plotting. ENU coordinates are perfect if you do the plotting yourself (they are also used by OpenStreetMapXPplot.jl). If you use library such as folium than it uses LLA coordinates and in the OpenStreetMapX tutorial you can find examples how to convert ENU to LLA.

huangapple
  • 本文由 发表于 2023年4月13日 23:53:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/76007459.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定