Skip to content
Closed
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
30 changes: 11 additions & 19 deletions src/expire-tiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,26 +200,18 @@ int expire_tiles::from_bbox(geom::box_t const &box)
}

/* Convert the box's Mercator coordinates into tile coordinates */
auto const tmp_min = coords_to_tile({box.min_x(), box.max_y()});
int min_tile_x = tmp_min.x() - tile_expiry_leeway;
int min_tile_y = tmp_min.y() - tile_expiry_leeway;
auto const tmp_min = coords_to_tile(box.min());
Copy link
Collaborator

Choose a reason for hiding this comment

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

This code is not the same. box.min() returns min_y while the old code has max_y. Is this a problem?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes it is! Now that we have tests (from another recently added PR) we can immediately see that they fail!

int const min_tile_x =
std::clamp(int(tmp_min.x() - tile_expiry_leeway), 0, m_map_width);
int const min_tile_y =
std::clamp(int(tmp_min.y() - tile_expiry_leeway), 0, m_map_width);

auto const tmp_max = coords_to_tile(box.max());
int const max_tile_x =
std::clamp(int(tmp_max.x() + tile_expiry_leeway), 0, m_map_width);
int const max_tile_y =
std::clamp(int(tmp_max.y() + tile_expiry_leeway), 0, m_map_width);

auto const tmp_max = coords_to_tile({box.max_x(), box.min_y()});
int max_tile_x = tmp_max.x() + tile_expiry_leeway;
int max_tile_y = tmp_max.y() + tile_expiry_leeway;

if (min_tile_x < 0) {
min_tile_x = 0;
}
if (min_tile_y < 0) {
min_tile_y = 0;
}
if (max_tile_x > m_map_width) {
max_tile_x = m_map_width;
}
if (max_tile_y > m_map_width) {
max_tile_y = m_map_width;
}
for (int iterator_x = min_tile_x; iterator_x <= max_tile_x; ++iterator_x) {
uint32_t const norm_x = normalise_tile_x_coord(iterator_x);
for (int iterator_y = min_tile_y; iterator_y <= max_tile_y;
Expand Down
5 changes: 0 additions & 5 deletions src/output-flex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1910,11 +1910,6 @@ void output_flex_t::delete_from_table(table_connection_t *table_connection,

if (m_expire.enabled() && table_connection->table().has_geom_column()) {
auto const result = table_connection->get_geom_by_id(type, id);

if (result.num_tuples() == 0) {
return;
}

expire_from_result(&m_expire, result);
}

Expand Down