[OSM-dev] Fixing invalid ghost lines in planet_osm_line

Jochen Topf jochen at remote.org
Wed Feb 3 09:21:08 UTC 2021


The bug you are talking about has been fixed in osm2pgsql and we'll
release a new version today or tomorrow that contains this fix. The bug
has been in the code for about 5 years and nobody noticed in that time,
so I don't expect that there are many cases out there. The problem will
fix itself over time when the data is updated anyway.

The error happens when there is a boundary relation containing exactly
two ways forming a closed ring and the ways are oriented against each
other. So they both have the same first and last nodes. The bug does
not appear when the last node of one of the ways is the first node of
the other. (Most likely the bug will also happen if there are four
ways of which two create one ring and two another etc.)

With that information it is possible to find all occurances in the
planet file, if somebody want to do this.

It is also possible to fix at least some of these cases by simply
turning around one of the member ways. You can do this without the
software having been updated. Just take care that turning around the
way doesn't create other problems.


On Tue, Feb 02, 2021 at 10:24:56PM +0100, Stephan Knauss wrote:
> the Carto Standard rendering, CyclOSM and Humanitarian all show a ghost
> line:
> https://www.openstreetmap.org/#map=19/8.20049/98.25165&layers=D
> https://tile.openstreetmap.org/19/405233/250160.png
> https://tile-a.openstreetmap.fr/hot/19/405233/250160.png
> https://a.tile-cyclosm.openstreetmap.fr/cyclosm/19/405233/250160.png
> I suspect that the underlying database is corrupt and has invalid entries in
> planet_osm_line.
> A similar bug was reported towards osm2pgsql
> https://github.com/openstreetmap/osm2pgsql/issues/1394
> and recently fixed:
> https://github.com/openstreetmap/osm2pgsql/pull/1396
> I assume here:
> https://github.com/openstreetmap/osm2pgsql/pull/1396/commits/2a52b6ca8fc0f5513e1c4e9da91cc2cc0b7aeca3
> A fresh imported dataset with a newer osm2pgsql version does not show this.
> Can it be confirmed that these are duplicates to this bug?
> It involves way 312514772 and way 312514768 which have no continuous
> direction.
> Is it possible to detect and fix in-place in the database? Any estimate how
> many geometries are affected by ghost lines?
> Stephan
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/dev

Jochen Topf  jochen at remote.org  https://www.jochentopf.com/  +49-351-31778688

More information about the dev mailing list