mirror of
https://github.com/osm2pgsql-dev/osm2pgsql.git
synced 2025-08-19 16:28:16 +00:00
Test that no maxzoom setting works on you'll get expire on zoom 0
This commit is contained in:
108
tests/bdd/flex/expire.feature
Normal file
108
tests/bdd/flex/expire.feature
Normal file
@ -0,0 +1,108 @@
|
||||
Feature: Changes on way with expire on zoom 0
|
||||
|
||||
Background:
|
||||
Given the style file 'test_expire.lua'
|
||||
|
||||
And the 0.1 grid
|
||||
| 11 | 13 |
|
||||
| 10 | 12 |
|
||||
|
||||
And the OSM data
|
||||
"""
|
||||
w11 v1 dV Tt1=yes Nn12,n13
|
||||
"""
|
||||
When running osm2pgsql flex with parameters
|
||||
| --slim |
|
||||
|
||||
Then table osm2pgsql_test_t1 contains exactly
|
||||
| way_id |
|
||||
| 11 |
|
||||
Then table osm2pgsql_test_expire contains exactly
|
||||
| zoom | x | y |
|
||||
|
||||
|
||||
Scenario: way is not relevant
|
||||
Given the OSM data
|
||||
"""
|
||||
w10 v1 dV Ta=b Nn10,n11
|
||||
"""
|
||||
And an empty grid
|
||||
|
||||
When running osm2pgsql flex with parameters
|
||||
| --slim | -a |
|
||||
|
||||
Then table osm2pgsql_test_t1 contains exactly
|
||||
| way_id |
|
||||
| 11 |
|
||||
Then table osm2pgsql_test_expire contains exactly
|
||||
| zoom | x | y |
|
||||
|
||||
|
||||
Scenario: node is not relevant
|
||||
Given the OSM data
|
||||
"""
|
||||
n1 v2 dV x1 y2
|
||||
"""
|
||||
And an empty grid
|
||||
|
||||
When running osm2pgsql flex with parameters
|
||||
| --slim | -a |
|
||||
|
||||
Then table osm2pgsql_test_t1 contains exactly
|
||||
| way_id |
|
||||
| 11 |
|
||||
Then table osm2pgsql_test_expire contains exactly
|
||||
| zoom | x | y |
|
||||
|
||||
|
||||
Scenario: add to t1
|
||||
Given the OSM data
|
||||
"""
|
||||
w10 v1 dV Tt1=yes Nn10,n11
|
||||
"""
|
||||
And an empty grid
|
||||
|
||||
When running osm2pgsql flex with parameters
|
||||
| --slim | -a |
|
||||
|
||||
Then table osm2pgsql_test_t1 contains exactly
|
||||
| way_id |
|
||||
| 10 |
|
||||
| 11 |
|
||||
Then table osm2pgsql_test_expire contains exactly
|
||||
| zoom | x | y |
|
||||
| 0 | 0 | 0 |
|
||||
|
||||
|
||||
Scenario: change in t1
|
||||
Given the OSM data
|
||||
"""
|
||||
w11 v2 dV Ta=b Nn10,n11
|
||||
"""
|
||||
And an empty grid
|
||||
|
||||
When running osm2pgsql flex with parameters
|
||||
| --slim | -a |
|
||||
|
||||
Then table osm2pgsql_test_t1 contains exactly
|
||||
| way_id |
|
||||
Then table osm2pgsql_test_expire contains exactly
|
||||
| zoom | x | y |
|
||||
| 0 | 0 | 0 |
|
||||
|
||||
|
||||
Scenario: remove from t1
|
||||
Given the OSM data
|
||||
"""
|
||||
w11 v2 dD
|
||||
"""
|
||||
And an empty grid
|
||||
|
||||
When running osm2pgsql flex with parameters
|
||||
| --slim | -a |
|
||||
|
||||
Then table osm2pgsql_test_t1 contains exactly
|
||||
| way_id |
|
||||
Then table osm2pgsql_test_expire contains exactly
|
||||
| zoom | x | y |
|
||||
| 0 | 0 | 0 |
|
@ -238,3 +238,26 @@ Feature: Expire configuration in Lua file
|
||||
Then table nodes has 1562 rows
|
||||
And table tiles has 0 rows
|
||||
|
||||
Scenario: Expire into table without maxzoom means maxzoom 0
|
||||
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
|
||||
And the lua style
|
||||
"""
|
||||
local eo = osm2pgsql.define_expire_output({
|
||||
table = 'tiles',
|
||||
})
|
||||
local t = osm2pgsql.define_node_table('nodes', {
|
||||
{ column = 'geom',
|
||||
type = 'point',
|
||||
expire = {
|
||||
{ output = eo }
|
||||
}}
|
||||
})
|
||||
|
||||
function osm2pgsql.process_node(object)
|
||||
t:insert({ geom = object:as_point() })
|
||||
end
|
||||
"""
|
||||
When running osm2pgsql flex
|
||||
Then table nodes has 1562 rows
|
||||
And table tiles has 0 rows
|
||||
|
||||
|
20
tests/data/test_expire.lua
Normal file
20
tests/data/test_expire.lua
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
-- No maxzoom sets it to 0
|
||||
local eo = osm2pgsql.define_expire_output({
|
||||
table = 'osm2pgsql_test_expire',
|
||||
})
|
||||
|
||||
local the_table = osm2pgsql.define_way_table('osm2pgsql_test_t1', {
|
||||
{ column = 'tags', type = 'hstore' },
|
||||
{ column = 'geom', type = 'linestring', expire = {{ output = eo }} },
|
||||
})
|
||||
|
||||
function osm2pgsql.process_way(object)
|
||||
if object.tags.t1 then
|
||||
the_table:insert{
|
||||
tags = object.tags,
|
||||
geom = object:as_linestring()
|
||||
}
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user