omniscale / imposm3

Imposm imports OpenStreetMap data into PostGIS
http://imposm.org/docs/imposm3/latest/
Apache License 2.0
730 stars 159 forks source link

Make sure that only polygons are inserted into Generalized tables #271

Closed pnorman closed 3 years ago

pnorman commented 3 years ago

Fixes #262 Replaces #263

It is possible for a polygon to turn into a MP after a buffer and simplify, so this uses ST_Dump to turn any MPs into simple polygons. This only seemed to turn up with PostGIS 3.

Tested with a dataset that triggered #262 but #263 did not fix.

As this fixes an unable to update issue that multiple people have encountered, it would be good to get it looked at and into a release soon.

olt commented 3 years ago

Polygon tables can always contain MultiPolygons from relations. I think this issue (#262) can only happen when the initial import is quite small and does not contain any multipolygon geometries for a layer. Is that right?

I'm in favor of the solution from #263 and try to use Geometry as the column type like we do for other polygon tables, instead of unpacking/dumping the multi polygon.

Can you go into detail what case is not fixed with #263? (With new imports, existing imports will have to manually change the column type.)

pnorman commented 3 years ago

I was testing against v0.10.0, which did not have the PostGIS 3 fixes in. With them in, I do not get this error anymore and cannot reproduce #262, so this PR is not needed.

The tables always end up with a type of geometry with no typemod restricting it to certain types of geometry. This happens even if the generalized table initially has only one type of geometry.