]> git.openstreetmap.org Git - rails.git/blobdiff - lib/gpx.rb
Round up the frame size for trace animations
[rails.git] / lib / gpx.rb
index 068b8481563dad0ae568a00d294eefb88cc71fda..0aa23ae0b026eddc1af146780a56ff982ce14364 100644 (file)
@@ -66,7 +66,7 @@ module GPX
       height = 250
       delay = 50
 
-      points_per_frame = num_points / nframes
+      points_per_frame = (num_points.to_f / nframes).ceil
 
       proj = OSM::Mercator.new(min_lat, min_lon, max_lat, max_lon, width, height)
 
@@ -114,6 +114,7 @@ module GPX
       end
 
       image = GD2::AnimatedGif.new
+      image.add(frames.first)
       frames.each do |frame|
         image.add(frame, :delay => delay)
       end