def get_one(self, tile): try: typeindex, tile.data = self.tiles[tile.tilecoord] tileformat = TileFormat.from_type_index(typeindex) tile.content_type = tileformat.content_type except KeyError: return None return tile
def get_one(self, tile): mongo_tilecoord = { "zoom_level":tile.tilecoord.z, "tile_column":tile.tilecoord.x, "tile_row":tile.tilecoord.y } mongo_tile = self.collection.find_one(mongo_tilecoord) if mongo_tile is None: return None tile.data = mongo_tile["tile_data"] tileformat = TileFormat.from_type_index(mongo_tile["tile_format"]) tile.content_type = tileformat.content_type return tile
def get_all(self): for tilecoord, typeindex, data in self.tiles.iteritems(): tile = Tile(tilecoord, data=data) tileformat = TileFormat.from_type_index(typeindex) tile.content_type = tileformat.content_type yield tile