def expand(self, tileset, amount=1):
     """Given a list of tiles, expand the coverage around those tiles"""
     tiles = {}
     tileset = [[int(b) for b in a.split(",")] for a in tileset]
     for tile in tileset:
         (x, y) = tile
         for dx in range(-amount, amount + 1):
             for dy in range(-amount, amount + 1):
                 tiles["%d,%d" % (x + dx, y + dy)] = True
     return tiles.keys()
Beispiel #2
0
 def expand(self, tileset, amount=1):
     """Given a list of tiles, expand the coverage around those tiles"""
     tiles = {}
     tileset = [[int(b) for b in a.split(",")] for a in tileset]
     for tile in tileset:
         (x, y) = tile
         for dx in range(-amount, amount + 1):
             for dy in range(-amount, amount + 1):
                 tiles["%d,%d" % (x + dx, y + dy)] = True
     return tiles.keys()
Beispiel #3
0
 def listTiles(self, route):
     """List all tiles touched by a polyline"""
     tiles = {}
     for pos in route:
         (lat, lon) = pos
         (tx, ty) = tileXY(lat, lon, 15)
         tile = "%d,%d" % (tx, ty)
         if not tiles.has_key(tile):
             tiles[tile] = True
     return tiles.keys()