Skip to content

Commit

Permalink
Merge pull request #404 from tilezen/extentchange
Browse files Browse the repository at this point in the history
make every zoom's tile use 4096 as extent
  • Loading branch information
peitili authored Dec 13, 2021
2 parents afd8bf8 + 43a4d4d commit c5b1683
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
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']
# 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

0 comments on commit c5b1683

Please sign in to comment.