Commits

Oliver Tonnhofer committed 06aa148

fixed one-off bug in grid.max_res

Comments (0)

Files changed (3)

 
 Fixes:
 - fixes demo on Windows (loaded static content from wrong path)
+- fixed one-off error with grid.max_res: last resolution is now < max_res
+  e.g. min_res: 1000 max_res: 300 -> now [1000, 500], before [1000, 500, 250]
 
 1.0.0 2011-03-03
 
             res = [10**(math.log10(min_res) - res_step*i) for i in range(num_levels)]
         else:
             res = [min_res]
-            while res[-1] > max_res:
-                res.append(res[-1]/res_factor)
+            while True:
+                next_res = res[-1]/res_factor
+                if max_res >= next_res:
+                    break
+                res.append(next_res)
     else:
         if not num_levels:
             num_levels = 20 if res_factor != math.sqrt(2) else 40
         res = [min_res]
         while len(res) < num_levels:
             res.append(res[-1]/res_factor)
-    
+        
     return res
 
 def grid_bbox(bbox, bbox_srs, srs):

mapproxy/test/unit/test_grid.py

     def test_min_res_max_res(self):
         conf = dict(min_res=1000, max_res=80)
         res = resolutions(**conf)
-        eq_(res, [1000, 500.0, 250.0, 125.0, 62.5])
+        eq_(res, [1000, 500.0, 250.0, 125.0])
     
     def test_min_res_levels(self):
         conf = dict(min_res=1600, num_levels=5)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.