谷歌地图上的自定义路线

发布于 2024-12-18 04:07:10 字数 209 浏览 2 评论 0原文

我有一个 Google 地图区域,其路线未定义。这是我大学的校园。我想要另外两座建筑物和一些折线来定义道路,因为道路未显示在地图上。然后我将应用 A* 算法来找到一条折线到另一条折线之间的最短路径。该地图将可供 Android 移动应用程序使用。在其基本状态下,应用程序更新用户的位置。例如,用户可以请求去工程学院。现在我怎么知道他在哪里,我的意思是路线的来源是什么,最近的折线?这是做事的方式吗?谢谢。

I have a Google map area for which routing is undefined. It is the campus for my university. I want to some two more buildings to it and some polylines to define the roads as the roads are not shown on the map. Then I will apply A* algorithm to find the shortest route between one polyline to the other. The map will be available to an android application for mobile. In its basic state the application updates the location of the user. The user can request to go to the faculty of engineering for example. Now how will I know where he is, i mean what is the source for the route, the closest polyline? Is this the way things are done? Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

林空鹿饮溪 2024-12-25 04:07:10
  1. 使用OpenStreetMap数据;您可以作为贡献者加入 OSM,并向地图添加建筑物、道路和其他内容。 OpenStreetMap 是一种维基百科,但包含地图,而不是百科全书文章。

  2. 下载并处理您校园的 OpenStreetMap 数据:获取所有可用作路线的折线;对他们的观点进行排序;识别多条折线共有的点 - 它们是节点;创建连接这些节点的弧的有向图。

  3. 使用有向图实现A*算法。 A*绝对是最好用的算法;快速、正确且有据可查。

  4. 使用 GPS 设备(您的代码正在其上运行)来找出您的用户所在的位置。 GPS 给出纬度/经度位置; OpenStreetMap 数据也以纬度/经度为单位;这样应该可以正常工作。

这自然需要一些研究和努力。我保证它会做你想要的,因为我自己已经做到了这一点(商业上 - 我不会链接到我的产品,因为我为此受到了指关节的敲击;但我自然声称做商业上的事情会施加一定的纪律) 。有很多开源软件可以帮助解决这些问题。特别是A*算法在维基百科上有很好的解释。

  1. Use OpenStreetMap data; you can join OSM as a contributor and add buildings, roads and other things to the map. OpenStreetMap is a sort of Wikipedia but with maps, not encyclopaedia articles.

  2. Download and process the OpenStreetMap data for your campus: get all the polylines usable as routes; sort their points; identify points common to more than one polyline - they are nodes; create a directed graph of arcs joining these nodes.

  3. Implement the A* algorithm using the directed graph. A* is definitely the best algorithm to use; fast, correct and well documented.

  4. Use a GPS device (on which your code is running) to find out where your user is. GPS gives positions in lat/long; OpenStreetMap data is also in lat/long; so that should work fine.

This will naturally involve some research and hard work. I guarantee it will do what you want, because I have done this myself (commercially - I won't link to my product because I have been rapped on the knuckles for that; but I naturally claim that doing something commercially imposes a certain discipline). There is plenty of open-source software to help with these things. In particular, the A* algorithm is explained very well on Wikipedia.

無處可尋 2024-12-25 04:07:10

我不认为 A* 算法是正确的算法。对于最短路径,dijkestra 算法更好。根据维基百科,A* 只是更快,但结果相同。其他一切似乎都很合理。

I don't think A* algorithm is the right algorithm. For shortest path dijkestra algorithm is better. According to wikipedia A* is only faster but have the same result. Everthing else seems very reasonable.

眸中客 2024-12-25 04:07:10

如果您的问题是查找用户的位置,那么您可以使用 GPS。
关于获取最短路径:A*比dijkestra更快,因此它是一个不错的选择,但获取结果可能需要从多段线的节点,而不是从一条多段线到另一条多段线

If your problem is to find the location of the user, then you can use GPS.
About getting the shortest route: A* is faster than dijkestra, so it is a good choice,but getting the result probably needs to be from the nodes of the poly lines, not from one poly line to the other

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文