def filter_tiles(tiles_fname, out_fname, bbox): # parse the bounding box arguments bbox = BoundingBox.fromStr(bbox) # load all tiles from the tile-spec json file that are relevant to our bounding box relevant_tiles = load_tiles(tiles_fname, bbox) # Create a tile-spec file that includes all relevant tiles with open(out_fname, 'w') as outfile: json.dump(relevant_tiles, outfile, sort_keys=True, indent=4)