显示 gpx 文件的地图

发布于 2024-12-27 01:20:00 字数 175 浏览 5 评论 0原文

我希望允许用户将跟踪路线的 gpx 文件上传到我的 Rails 3.2 应用程序,并在地图上显示它们,即使用 Google 地图。

我怎样才能做到这一点?有没有比我自己解析 gpx 文件、将所有航点存储在我的数据库中并通过 json 为 Google Maps API 提供它们更简单的方法?

提前致谢!

I want to allow users to upload gpx files of a tracked route to my rails 3.2 app and to show them on a map, i.e. by using Google Maps.

How can I do that? Is there an easier way than parsing the gpx file by myself, store all waypoints in my database and provide them via json for the Google Maps API?

Thanks in advance!

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

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

发布评论

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

评论(1

‖放下 2025-01-03 01:20:00

抱歉,我不是 Ruby 专家。然而,地理数据抽象库(GDAL)应该很好地处理这个问题。 GDAL 有 Ruby 绑定:
http://trac.osgeo.org/gdal/wiki/GdalOgrInRuby

我建议使用它将 GPX 转换为 KML,然后使用 KMLLayer 对象显示 KML。您将使用 ogr2ogr:
http://gdal.org/ogr2ogr.html

这是 KMLLayer:
http://code.google.com/apis/maps/documentation /javascript/layers.html#KMLLayers

Sorry, not much of a Ruby expert. However, the Geographic Data Abstraction Library (GDAL) should handle this very well. GDAL has Ruby bindings:
http://trac.osgeo.org/gdal/wiki/GdalOgrInRuby

I would suggest using it to convert GPX to KML and then using the KMLLayer object to display the KML. You would use ogr2ogr:
http://gdal.org/ogr2ogr.html

Here's the KMLLayer:
http://code.google.com/apis/maps/documentation/javascript/layers.html#KMLLayers

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