[Tile-serving] [openstreetmap/osm2pgsql] Use libosmium for geometry building (#684)
Sarah Hoffmann
notifications at github.com
Sat Feb 4 21:32:22 UTC 2017
This PR replaces the libgeos-based geometry builder with the libosmium area assembly. As libosmium approaches multipolygon assembly in a slightly different way, there are some visible changes to the polygon handling, as well as some secondary changes.
Changes in Polygon Handling
---------------------------
* *Geometry type is determined by tagging only.* Previously osm2pgsql would create polygons only when a polygon was requested by the tagtransform and the geometry could actually assembled into rings. Otherwise a linestring was added to the *_ways table. This could lead to the odd situation where a partially broken multipolygon had some of its rings in the polygon table and the unclosed ways in the ways table. New behaviour is that only the result of tagtransform (or for output-multi: the requested format for the table) is taken into account. In some corner cases, this can lead to a regression with the C-transform when keys may describe a polygon or a way.
* *Broken geometries are not recovered.* The libgeos geometry builder was very forgiving with broken polygons and would create a partial solution. The libosmium assembler uses an all or nothing approach. If the geometry is bad, the entire object is discarded. There is also no more buffering of geometries to recover them. On the plus side, libosmium can handle geometries where rings touch in more than one point, which is permissible in OSM but not for OGR polygons.
* *`--exclude-invalid-polygon` removed.* libosmium never creates invalid geometries.
* *Line merging has different results.* For route relations a custom line merging algorithm has been added which seems to be much more aggressive than the one employed by libgeos.
Other Changes
-------------
* Reprojection of geometries now moved into geometry assembler because libosmium can build geometries only in WSG84.
* Expiry works now on binary wkb only. This actually results in much cleaner code.
* Some streamlining of middle interface (mostly working more with the native libosmium types).
* now unused custom nodelist_t and multinodelist_t removed.
Todo
----
- [ ] get libosmium area assembler changes into mainline (see https://github.com/osmcode/libosmium/issues/194)
- [ ] fix regression tests (need to go each of the differences and check if the results are expected)
- [ ] test with larger imports and visually check results
- [ ] update documentation
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/osm2pgsql/pull/684
-- Commit Summary --
* improve constness of parsed osmium objects
* add node retrival functions without projection
* initial version of osmium geometry building in output-pgsql
* expire directly from wkb
* add linemerger for route relations
* add multipolygon split-up
* convert remaining outputs to libosmium
* move wkb writing in a separate class
* remove geometry builder and geos dependency
* remove unused functions from expire
* remove now unused write_row functions in table
* remove unused get_node_list() function for nodelist_t
* fix area string conversion
* remove remaining traces of nodelist types
* streamline retival of ways for relations
* add converter from hex to binary wkb
* output-multi: compute way_area only when there is a column with the name
* remove unused exclude-invalid-polygon option
* remove unused code
-- File Changes --
M CMakeLists.txt (7)
M README.md (2)
M contrib/libosmium/osmium/area/assembler.hpp (37)
M contrib/libosmium/osmium/area/detail/segment_list.hpp (37)
M expire-tiles.cpp (152)
M expire-tiles.hpp (11)
D geometry-builder.cpp (739)
D geometry-builder.hpp (114)
M geometry-processor.cpp (101)
M geometry-processor.hpp (38)
M middle-pgsql.cpp (146)
M middle-pgsql.hpp (9)
M middle-ram.cpp (30)
M middle-ram.hpp (6)
M middle.hpp (21)
M node-persistent-cache.cpp (32)
M node-persistent-cache.hpp (3)
M options.cpp (7)
M options.hpp (1)
M osmdata.cpp (13)
M osmdata.hpp (4)
A osmium-builder.cpp (421)
A osmium-builder.hpp (51)
M osmtypes.hpp (3)
M output-gazetteer.cpp (89)
M output-gazetteer.hpp (40)
M output-multi.cpp (129)
M output-multi.hpp (13)
M output-null.cpp (4)
M output-null.hpp (4)
M output-pgsql.cpp (375)
M output-pgsql.hpp (26)
M output.hpp (4)
M parse-osmium.cpp (8)
M parse-osmium.hpp (4)
M processor-line.cpp (20)
M processor-line.hpp (14)
M processor-point.cpp (14)
M processor-point.hpp (12)
M processor-polygon.cpp (20)
M processor-polygon.hpp (16)
M table.cpp (38)
M table.hpp (5)
M taginfo.cpp (16)
M taginfo_impl.hpp (1)
M tests/middle-tests.cpp (82)
M tests/mockups.hpp (24)
M tests/test-options-parse.cpp (1)
M tests/test-output-multi-line.cpp (4)
M tests/test-output-pgsql-tablespace.cpp (4)
M tests/test-output-pgsql-validgeom.cpp (2)
M tests/test-output-pgsql.cpp (12)
M tests/test-parse-diff.cpp (6)
M tests/test-parse-xml2.cpp (10)
A wkb.hpp (361)
-- Patch Links --
https://github.com/openstreetmap/osm2pgsql/pull/684.patch
https://github.com/openstreetmap/osm2pgsql/pull/684.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/684
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20170204/c8aa2c47/attachment.html>
More information about the Tile-serving
mailing list