简体   繁体   English

如何确定路线图上是否有一定纬度和经度的点?

[英]How can we find out if a point with a certain lat and long is located on road graph?

I am writing a Windows application in C# which should find the nearest path (road) between two points in the city. 我正在用C#编写Windows应用程序,该应用程序应该找到城市两点之间的最近路径(道路)。 I needed to access the road data, like the coordinates of the beginning and end of the roads, maybe a complete database. 我需要访问道路数据,例如道路起点和终点的坐标,也许是一个完整的数据库。

I did not know how I can access such an information or file. 我不知道如何访问此类信息或文件。 So for simplicity I assumed some certain vertices and the edges (the connection between the vertices). 因此,为简单起见,我假定了某些顶点和边缘(顶点之间的连接)。 Now I have a point (coordinates of a specific location). 现在我有一个点(特定位置的坐标)。 I want to see on which edge this point is located. 我想看看此点位于哪条边上。 I see by just having information about start and end of vertices and the connection between them (edges=roads) I cannot locate a position of a point on the roads. 通过仅获得有关顶点的起点和终点以及它们之间的连接(边=道路)的信息,我看不到道路上某个点的位置。 I need to know if there is any way to find out if a point with a specific coordinates is located on a specific road. 我需要知道是否有任何方法可以找出具有特定坐标的点是否位于特定道路上。 I also want to know what kind of information do usually map data contain--is it just the coordinates of two ends of roads, or more info about roads? 我还想知道地图数据通常包含哪些信息-是仅仅是道路两端的坐标,还是有关道路的更多信息?

You need to calculate the distances between the position and road, then you look at the distance and determine if it's close enough. 您需要计算位置和道路之间的距离,然后查看距离并确定距离是否足够近。 For the distance from point a to line b you need to calculate point c on b where c to a is perpendicular to b. 对于从点a到线b的距离,您需要计算b上的点c,其中c到a垂直于b。

To actually calculate these distances you need to do quite some math (take in the rounding of the earth) so I hope you got some skills there. 要真正计算这些距离,您需要做一些数学运算(考虑地球的绕圆),因此我希望您在那里掌握了一些技能。 Explanation on how to calculate distances between coordinates and between a line and a point . 有关如何计算坐标之间以及线与点之间的 距离的说明。

I wrote a GPS application where the distance to a point had to be 25 meters for the current postion to be on the point. 我编写了一个GPS应用程序,其中到一个点的距离必须为25米,当前位置才能在该点上。 This extra space it quite important because GPS is 10 meters inaccurate by design, so if you get your data from GPS and you must be 1 meter close to your target, chances are you will never reach it, even if your standing next to it. 这个额外的空间非常重要,因为GPS在设计上不准确10米,因此,如果您从GPS获取数据,并且您必须距离目标1米,那么即使站在旁边,您也永远无法到达目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM