From: Tom Hughes Date: Tue, 19 Jun 2007 13:58:44 +0000 (+0000) Subject: Cope with the degenerate case of a GPX file with only a single point. X-Git-Tag: live~8356 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/7f2756fe204ba728c2cb282fb0e372be1afc317f Cope with the degenerate case of a GPX file with only a single point. --- diff --git a/lib/osm.rb b/lib/osm.rb index 1941d6daf..40ec9da3d 100644 --- a/lib/osm.rb +++ b/lib/osm.rb @@ -22,10 +22,11 @@ module OSM @clat = lat @clon = lon @degrees_per_pixel = degrees_per_pixel + @degrees_per_pixel = 0.0000000001 if @degrees_per_pixel < 0.0000000001 @width = width @height = height - @dlon = width / 2 * degrees_per_pixel - @dlat = height / 2 * degrees_per_pixel * cos(@clat * PI / 180) + @dlon = width / 2 * @degrees_per_pixel + @dlat = height / 2 * @degrees_per_pixel * cos(@clat * PI / 180) @tx = xsheet(@clon - @dlon) @ty = ysheet(@clat - @dlat) @@ -197,7 +198,7 @@ module OSM end def get_icon(min_lat, min_lon, max_lat, max_lon) - puts "getting icon for bbox #{min_lat},#{min_lon} - #{max_lat},#{max_lon}" + #puts "getting icon for bbox #{min_lat},#{min_lon} - #{max_lat},#{max_lon}" width = 50 height = 50 rat= Math.cos( ((max_lat + min_lat)/2.0) / 180.0 * 3.141592)