Skip to content
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

make every zoom's tile use 4096 as extent #404

Merged
merged 6 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
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
10 changes: 7 additions & 3 deletions tests/test_mvt.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ def _check_metatile(self, metatile_size):
for (posargs, kwargs), coord in zip(encode.call_args_list,
tile_coords):
self.assertIn('quantize_bounds', kwargs)
quantize_bounds = kwargs['quantize_bounds']
extent = int(round((quantize_bounds[2] - quantize_bounds[0]) /
resolution))
# We hardcoded the extent to be 4096 in
# https://github.com/tilezen/tilequeue/pull/404
# thus the extent calculation is thus commented out
# quantize_bounds = kwargs['quantize_bounds']
Copy link
Member

Choose a reason for hiding this comment

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

Delete these instead of commenting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Delete these instead of commenting?

we hardcoded it to be 4096, but a better logic would be to use some of the commented out calculation; so maybe we should keep them? I added more comments/doc for this in the next commit.

# extent = int(round((quantize_bounds[2] - quantize_bounds[0]) /
# resolution))
extent = 4096
self.assertIn('extents', kwargs)
actual_extent = kwargs['extents']
self.assertEquals(extent, actual_extent,
Expand Down
17 changes: 9 additions & 8 deletions tilequeue/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,18 +518,19 @@ def format_coord(

formatted_tiles = []
for cut_coord in cut_coords:
cut_scale = _calculate_scale(scale, coord, nominal_zoom)

# we hardcoded the extent to be 4096 in
# https://github.com/tilezen/tilequeue/pull/404
# before, the scale is calculated by
# _calculate_scale(scale, coord, nominal_zoom)
if cut_coord == coord:
# no need for cutting if this is the original tile.
tiles = _format_feature_layers(
processed_feature_layers, coord, nominal_zoom, max_zoom_with_changes, formats,
unpadded_bounds, cut_scale, buffer_cfg)

processed_feature_layers, cut_coord, nominal_zoom,
max_zoom_with_changes, formats, unpadded_bounds, scale,
buffer_cfg)
else:
tiles = _cut_child_tiles(
processed_feature_layers, cut_coord, nominal_zoom, max_zoom_with_changes, formats,
_calculate_scale(scale, cut_coord, nominal_zoom), buffer_cfg)
processed_feature_layers, cut_coord, nominal_zoom,
max_zoom_with_changes, formats, scale, buffer_cfg)

formatted_tiles.extend(tiles)

Expand Down