Last active
October 14, 2015 16:51
-
-
Save rmarianski/1660860694f27fe054c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from redis import StrictRedis | |
from tilequeue.cache import RedisCacheIndex | |
from tilequeue.tile import coord_to_bounds | |
from tilequeue.tile import coord_unmarshall_int | |
from tilequeue.tile import serialize_coord | |
import shapely.geometry | |
redis_host = '...' | |
redis_client = StrictRedis(redis_host) | |
cache_index = RedisCacheIndex(redis_client) | |
tiles_of_interest = cache_index.fetch_tiles_of_interest() | |
# this is in lat/lon | |
antarctica_shape = shapely.geometry.box(-180, -85, 180, -60) | |
antarctica_toi_coords = [] | |
for coord_int in tiles_of_interest: | |
coord = coord_unmarshall_int(coord_int) | |
coord_bounds = coord_to_bounds(coord) | |
coord_bounds_shape = shapely.geometry.box(*coord_bounds) | |
if coord_bounds_shape.intersects(antarctica_shape): | |
antarctica_toi_coords.append(coord) | |
antarctica_toi_coords.sort(key=lambda c: (c.zoom, c.column, c.row)) | |
with open('antarctica_toi_coords.txt', 'w') as fp: | |
for coord in antarctica_toi_coords: | |
coord_str = serialize_coord(coord) | |
fp.write(coord_str + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment