3 xml.gpx("version" => "1.0",
4 "creator" => "OpenStreetMap.org",
5 "xmlns" => "http://www.topografix.com/GPX/1/0") do
6 # initialise these variables outside of the loop so that they
7 # stay in scope and don't get free'd up by the GC during the
17 @points.each do |point|
18 if gpx_id != point.gpx_id
22 if point.trace.trackable?
27 if point.trace.identifiable?
28 track["name"] = point.trace.name
29 track["desc"] = point.trace.description
30 track["url"] = url_for(:controller => "/traces", :action => "show", :display_name => point.trace.user.display_name, :id => point.trace.id)
33 # use the anonymous track segment if the user hasn't allowed
34 # their GPX points to be tracked.
37 anon_track["trksegs"] = []
44 if trackid != point.trackid
45 if point.trace.trackable?
47 track["trksegs"] << trkseg
48 trackid = point.trackid
52 anon_track["trksegs"] << anon_trkseg
68 trk["trksegs"].each do |trksg|
70 trksg.each do |tracepoint|
71 xml.trkpt("lat" => tracepoint.lat.to_s, "lon" => tracepoint.lon.to_s) do
72 xml.time tracepoint.timestamp.xmlschema if tracepoint.trace.trackable?