Skip to content

Add the ability to list individual tiles that should stay in the TOI #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 29, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions tilequeue/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,17 +994,29 @@ def tilequeue_prune_tiles_of_interest(cfg, peripherals):

logger.info('Fetching tiles recently requested ... done. %s found', n_trr)

for name, info in prune_cfg.get('always-include-bboxes', {}).items():
for name, info in prune_cfg.get('always-include', {}).items():
logger.info('Adding in tiles from %s ...', name)

bounds = map(float, info['bbox'].split(','))
bounds_tileset = set()
for coord in tile_generator_for_single_bounds(
bounds, info['min_zoom'], info['max_zoom']):
coord_int = coord_marshall_int(coord)
bounds_tileset.add(coord_int)
n_inc = len(bounds_tileset)
new_toi = new_toi.union(bounds_tileset)
immortal_tiles = set()
if 'bbox' in info:
bounds = map(float, info['bbox'].split(','))
for coord in tile_generator_for_single_bounds(
bounds, info['min_zoom'], info['max_zoom']):
coord_int = coord_marshall_int(coord)
immortal_tiles.add(coord_int)
elif 'tiles' in info:
tiles = map(deserialize_coord, info['tiles'])
tiles = map(coord_marshall_int, tiles)
immortal_tiles.update(tiles)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I make a feature request? :) How about adding something like path or file(s). We would expect that the file contains coordinates, one per line.

I'm expecting that when we add the tests, what we'll do is first run the script that prints them out. And then we can save that to a file and feed it into this. Maybe another option is to read it from stdin to avoid having the temporary file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in e17b902.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

elif 'file' in info:
with open(info['file'], 'r') as f:
immortal_tiles.update(
coord_marshall_int(deserialize_coord(l.strip()))
for l in f
)

n_inc = len(immortal_tiles)
new_toi = new_toi.union(immortal_tiles)

logger.info('Adding in tiles from %s ... done. %s found', name, n_inc)

Expand Down