Skip to content

Commit 4a85d1b

Browse files
authored
Merge pull request #2424 from joto/fix-expire-maxzoom0
Fix: Always disable expiry if maxzoom==0
2 parents 69a53b1 + be86625 commit 4a85d1b

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/expire-tiles.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ void expire_tiles_t::from_geometry(geom::multipolygon_t const &geom,
147147
void expire_tiles_t::from_geometry(geom::geometry_t const &geom,
148148
expire_config_t const &expire_config)
149149
{
150+
if (!enabled()) {
151+
return;
152+
}
153+
150154
geom.visit([&](auto const &g) { from_geometry(g, expire_config); });
151155
}
152156

@@ -224,10 +228,6 @@ void expire_tiles_t::from_line_segment(geom::point_t const &a,
224228
int expire_tiles_t::from_bbox(geom::box_t const &box,
225229
expire_config_t const &expire_config)
226230
{
227-
if (!enabled()) {
228-
return 0;
229-
}
230-
231231
double const width = box.width();
232232
double const height = box.height();
233233
if (width > tile_t::HALF_EARTH_CIRCUMFERENCE + 1) {

tests/bdd/flex/expire.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Feature: Changes on way with expire on zoom 0
1+
Feature: Changes on way with expire on zoom 1
22

33
Background:
44
Given the style file 'test_expire.lua'
@@ -71,7 +71,7 @@ Feature: Changes on way with expire on zoom 0
7171
| 11 |
7272
Then table osm2pgsql_test_expire contains exactly
7373
| zoom | x | y |
74-
| 0 | 0 | 0 |
74+
| 1 | 1 | 0 |
7575

7676

7777
Scenario: change in t1
@@ -88,7 +88,7 @@ Feature: Changes on way with expire on zoom 0
8888
| way_id |
8989
Then table osm2pgsql_test_expire contains exactly
9090
| zoom | x | y |
91-
| 0 | 0 | 0 |
91+
| 1 | 1 | 0 |
9292

9393

9494
Scenario: remove from t1
@@ -105,4 +105,4 @@ Feature: Changes on way with expire on zoom 0
105105
| way_id |
106106
Then table osm2pgsql_test_expire contains exactly
107107
| zoom | x | y |
108-
| 0 | 0 | 0 |
108+
| 1 | 1 | 0 |

tests/data/test_expire.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
-- No maxzoom sets it to 0
32
local eo = osm2pgsql.define_expire_output({
43
table = 'osm2pgsql_test_expire',
4+
maxzoom = 1,
55
})
66

77
local the_table = osm2pgsql.define_way_table('osm2pgsql_test_t1', {

0 commit comments

Comments
 (0)