Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Automated merge with https://ecometrica.kilnhg.com/Code/Public/group/…

  • Loading branch information...
commit 7c960c30ec48134f44f9e2da49106a61a1536530 2 parents bea40c0 + 11b9b5c
authored November 28, 2012
2  gdal2mbtiles/gdal.py
@@ -599,7 +599,7 @@ def GetTiledExtents(self, transform=None, resolution=None):
599 599
         return Extents(lower_left=XY(left, bottom),
600 600
                        upper_right=XY(right, top))
601 601
 
602  
-    def GetTileScalingRatios(self, resolution=None, places=None):
  602
+    def GetScalingRatios(self, resolution=None, places=None):
603 603
         """
604 604
         Get the scaling ratios required to upsample an image to `resolution`.
605 605
 
8  gdal2mbtiles/vips.py
@@ -577,7 +577,7 @@ def ReadAsArray(self, xoff=0, yoff=0, win_xsize=None, win_ysize=None,
577 577
         if win_ysize is None:
578 578
             win_ysize = image.Ysize() - yoff
579 579
 
580  
-        band = image.extract_bands(self._band_no, 1)
  580
+        band = image.extract_bands(band=self._band_no, nbands=1)
581 581
         area = band.extract_area(left=xoff, top=yoff,
582 582
                                  width=win_xsize, height=win_ysize)
583 583
 
@@ -615,8 +615,8 @@ def image(self):
615 615
         return self._image
616 616
 
617 617
     def GetRasterBand(self, i):
618  
-        return VipsBand(band=super(Dataset, self).GetRasterBand(i),
619  
-                        dataset=self, band_no=i-1)
  618
+        return VipsBand(band=super(VipsDataset, self).GetRasterBand(i),
  619
+                        dataset=self, band_no=(i - 1))
620 620
 
621 621
     def ReadAsArray(self, xoff=0, yoff=0, xsize=None, ysize=None,
622 622
                     buf_obj=None):
@@ -671,7 +671,7 @@ def _upsample(self, ratios):
671 671
     def upsample(self, resolution=None):
672 672
         """Upsamples the image to `resolution`."""
673 673
         return self._upsample(
674  
-            ratios=self.GetTileScalingRatios(resolution=resolution, places=5)
  674
+            ratios=self.GetScalingRatios(resolution=resolution, places=5)
675 675
         )
676 676
 
677 677
     def upsample_to_world(self):
10  tests/test_gdal.py
@@ -785,29 +785,29 @@ def test_get_tiled_extents_partial_spanning(self):
785 785
     def test_get_tile_scaling_ratios(self):
786 786
         # bluemarble.tif is a 1024 × 1024 whole-world map
787 787
         dataset = Dataset(inputfile=self.inputfile)
788  
-        ratio = dataset.GetTileScalingRatios()
  788
+        ratio = dataset.GetScalingRatios()
789 789
         self.assertAlmostEqual(ratio.x, 1.0)
790 790
         self.assertAlmostEqual(ratio.y, 1.0)
791 791
 
792 792
         # Test rounding
793  
-        ratio = dataset.GetTileScalingRatios(places=5)
  793
+        ratio = dataset.GetScalingRatios(places=5)
794 794
         self.assertEqual(ratio.x, 1.0)
795 795
         self.assertEqual(ratio.y, 1.0)
796 796
 
797 797
         # upsampling.tif is a 256 × 256 whole-world map
798 798
         dataset = Dataset(inputfile=self.upsamplingfile)
799  
-        ratio = dataset.GetTileScalingRatios()
  799
+        ratio = dataset.GetScalingRatios()
800 800
         self.assertAlmostEqual(ratio.x, 1.0)
801 801
         self.assertAlmostEqual(ratio.y, 1.0)
802 802
 
803 803
         # bluemarble-spanning-foreign.tif is a 154 × 154 partial map
804 804
         dataset = Dataset(inputfile=self.foreignfile)
805  
-        ratio = dataset.GetTileScalingRatios()
  805
+        ratio = dataset.GetScalingRatios()
806 806
         self.assertAlmostEqual(ratio.x, 4.0 / 3.0)
807 807
         self.assertAlmostEqual(ratio.y, 4.0 / 3.0)
808 808
 
809 809
         # Test rounding
810  
-        ratio = dataset.GetTileScalingRatios(places=5)
  810
+        ratio = dataset.GetScalingRatios(places=5)
811 811
         self.assertEqual(ratio.x, 1.33333)
812 812
         self.assertEqual(ratio.y, 1.33333)
813 813
 

0 notes on commit 7c960c3

Please sign in to comment.
Something went wrong with that request. Please try again.