show a map for a gpx file

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, ie 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!


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

链接地址: http://www.djcxy.com/p/23348.html

上一篇: Google地图轨道颜色

下一篇: 显示一个gpx文件的地图