Optionally wrap polygon geometries in multipolygons#1327
Optionally wrap polygon geometries in multipolygons#1327lonvia merged 4 commits intoosm2pgsql-dev:masterfrom
Conversation
lonvia
left a comment
There was a problem hiding this comment.
Looks good to me. Can we have nice error messages now instead of COPY failing on bad geometry types?
| create_multigeoms = geom::create_multi_t::always; | ||
| } else if (m_multi) { | ||
| create_multigeoms = geom::create_multi_t::optional; | ||
| } |
There was a problem hiding this comment.
If I read this right, then the multi flag is ignored, when the type is MULTIPOLYGON. Makes perfect sense but it might be worth documenting (and possibly testing, to document that this was the intended behaviour ;).
There was a problem hiding this comment.
After some more thought, this wasn't the right choice. The multi setting should be independent of the target geometry type. The new code implements this that way.
67a1ae0 to
9dc6421
Compare
|
I have restructured the code to better match intentions and added tests. Also added a new commit that switches the default for the multi setting from false to true as outlined in #1316. The config option is now called |
Unfortunately not. The code creates WKB geometries and you can't tell later what type of geometry they are (without hacks), so we can't do the check. We'll rework the geometry code anyway in the near future using actual geometry types and then we can do this easily. |
Currently the parameter is still unused.
When you have an area table in the flex output, you always had to use the "geometry" column type for the geometry column, because ways are turned into polygons and multipolygon relations are turned into polygons or multipolygons. The common type for these is the generic "geometry". With this change, declaring a geometry column as type "multipolygon" now works. All polygon geometries are automatically wrapped in a multipolygon before adding them to the database. Depending on what you are doing this might be want you want or not. It will make the geometries larger, but it also makes the data more consistent and so easier to work with and some software can only handle this consistent data. See osm2pgsql-dev#1316
Also changes the name of the setting in the flex_config from multi=true/false to split_at=nil/'multi'.
9dc6421 to
819d611
Compare
When you have an area table in the flex output, you always had to use the "geometry" column type for the geometry column, because ways are turned into polygons and multipolygon relations are turned into polygons or multipolygons. The common type for these is the generic "geometry".
With this change, declaring a geometry column as type "multipolygon" now works. All polygon geometries are automatically wrapped in a multipolygon before adding them to the database. Depending on what you are doing this might be want you want or not. It will make the geometries larger, but it also makes the data more consistent and so easier to work with and some software can only handle this consistent data.
See #1316