Ejemplo n.º 1
0
 def test_gridtiles(self):
     mb = ImageExporter()
     # At zoom level 0
     grid = mb.grid_tiles((-180.0, -90.0, 180.0, 90.0), 0)
     self.assertEqual(grid, [[(0, 0)]])
     # At zoom level 1
     grid = mb.grid_tiles((-180.0, -90.0, 180.0, 90.0), 1)
     self.assertEqual(grid, [[(0, 0), (1, 0)], [(0, 1), (1, 1)]])
Ejemplo n.º 2
0
 def test_gridtiles(self):
     mb = ImageExporter()
     # At zoom level 0
     grid = mb.grid_tiles((-180.0, -90.0, 180.0, 90.0), 0)
     self.assertEqual(grid, [[(0, 0)]])
     # At zoom level 1
     grid = mb.grid_tiles((-180.0, -90.0, 180.0, 90.0), 1)
     self.assertEqual(grid, [[(0, 0), (1, 0)],
                             [(0, 1), (1, 1)]])
Ejemplo n.º 3
0
 def test_exportimage(self):
     from PIL import Image
     output = "image.png"
     ie = ImageExporter()
     ie.export_image((-180.0, -90.0, 180.0, 90.0), 2, output)
     i = Image.open(output)
     self.assertEqual((1024, 1024), i.size)
     os.remove(output)
     # Test from other mbtiles
     mb = MBTilesBuilder(filepath='toulouse.mbtiles')
     mb.add_coverage(bbox=(1.3, 43.5, 1.6, 43.7), zoomlevels=[12])
     mb.run()
     ie = ImageExporter(mbtiles_file=mb.filepath)
     ie.export_image((1.3, 43.5, 1.6, 43.7), 12, output)
     os.remove('toulouse.mbtiles')
     i = Image.open(output)
     self.assertEqual((1280, 1024), i.size)
     os.remove(output)
Ejemplo n.º 4
0
 def test_exportimage(self):
     from PIL import Image
     output = "image.png"
     ie = ImageExporter()
     ie.export_image((-180.0, -90.0, 180.0, 90.0), 2, output)
     i = Image.open(output)
     self.assertEqual((1024, 1024), i.size)
     os.remove(output)
     # Test from other mbtiles
     mb = MBTilesBuilder(filepath='toulouse.mbtiles')
     mb.add_coverage(bbox=(1.3, 43.5, 1.6, 43.7), zoomlevels=[12])
     mb.run()
     ie = ImageExporter(mbtiles_file=mb.filepath)
     ie.export_image((1.3, 43.5, 1.6, 43.7), 12, output)
     os.remove('toulouse.mbtiles')
     i = Image.open(output)
     self.assertEqual((1280, 1024), i.size)
     os.remove(output)