Deleted features doesn't mark tile as expired
zdila opened this issue · 6 comments
Context
If the changeset contains delete-only operation (eg. deleted a building) then it's import doesn't generate expired tile.
Expected Behavior
Expired tile should be generated.
Actual Behavior
Expired tile is not generated.
Steps to Reproduce
- have
~/go/bin/imposm run -connection postgis://gis:secret@localhost/gis -mapping mapping.yaml -limitto limit.geojson -cachedir ./cache -diffdir ./diff -expiretiles-zoom 15 -expiretiles-dir ./expires
running - delete single building from OSM
- osm changeset is applied to the DB by imposm3 but it is not reflected in
./expires
dir
Context
We are trying to have a map rendered by mapnik in sync with OSM data.
Your Environment
- Version used: 5b0125c
- Environment name and version: Debian Buster, PostgreSQL 11.3
Can you provide more information?
A delete of a way should be handled by Imposm and there is a test case:
https://github.com/omniscale/imposm3/blob/master/test/expire_tiles.osc#L40...L43
https://github.com/omniscale/imposm3/blob/master/test/expire_tiles_test.go#L103
Please extract files from https://drive.google.com/open?id=1eIfafN_gosS0rhBFn1JhdGm0FYTzgsFV:
- diff file
230.osc.gz
contains a change that deletes building imported frombuilding.osm.pbf
mapping.yaml
is the mapping file we use- diff file
277.osc.gz
contains a changeset that adds a new building on different location
Steps:
- run
~/go/bin/imposm import -connection postgis://gis:gis@localhost/gis -mapping mapping.yaml -read building.osm.pbf -diff -write -cachedir ./cache -diffdir ./diff -overwritecache
- run
~/go/bin/imposm import -connection postgis://gis:gis@localhost/gis -mapping mapping.yaml -deployproduction
- check that single building is present in
osm_buildings
table - run
~/go/bin/imposm diff -connection postgis://gis:gis@localhost/gis -mapping mapping.yaml -cachedir ./cache -diffdir ./diff -expiretiles-dir ./expires 230.osc.gz
- check that there is no building in
osm_buildings
table but noexpires
dir is created even if it should - run
~/go/bin/imposm diff -connection postgis://gis:gis@localhost/gis -mapping mapping.yaml -cachedir ./cache -diffdir ./diff -expiretiles-dir ./expires 277.osc.gz
- check that new building is created in
osm_buildings
table andexpires
is created with correct*.tiles
file
@olt Is there anything else I can provide?
(Even maybe some microfunding, or credits at https://www.freemap.sk/ (credits modal is not ready yet))?
Thanks
@olt I did some more tests and narrowed down the conditions. I found that tile is not marked as dirty if you not only delete a way but also all its nodes. If you apply following patch then the test will fail:
diff --git a/test/expire_tiles.osc b/test/expire_tiles.osc
index b2d4772..19255c4 100644
--- a/test/expire_tiles.osc
+++ b/test/expire_tiles.osc
@@ -37,7 +37,13 @@
</way>
</modify>
- <!-- delete way -->
+ <!-- delete way including its nodes -->
+ <delete>
+ <node id="20201" version="1" timestamp="2011-11-11T00:11:11Z" lat="2.0" lon="2.0001" />
+ </delete>
+ <delete>
+ <node id="20202" version="1" timestamp="2011-11-11T00:11:11Z" lat="2.0" lon="2.0002" />
+ </delete>
<delete>
<way id="20251" version="1" timestamp="2011-11-11T00:11:11Z" />
</delete>
Failed test:
...
--- FAIL: TestExpireTiles (0.73s)
--- FAIL: TestExpireTiles/CheckExpireFile (0.00s)
expire_tiles_test.go:164: missing expire tile for delete way {8283 8100 14}
FAIL
FAIL github.com/omniscale/imposm3/test 0.745s
Thanks for creating the failing test case. Imposm assumed that the changesets are always in a "consistent" order. This is now fixed.
Thank you!