[Tile-serving] [openstreetmap/osm2pgsql] Add support for data generalization (PR #1942)

Jochen Topf notifications at github.com
Thu Mar 2 09:06:42 UTC 2023


This large commit adds a framework to generalize OSM data using different strategies and implements several strategies. The source is all in the new `src/gen` directory. It includes a new command `osm2pgsql-gen` to access this functionality. Future versions might integrate it with the `osm2pgsql` command, but because this is all experimental it is kept separate for now. Call `osm2pgsql-gen` with `-h` to get usage help.

See also https://osm2pgsql.org/generalization/ and the chapter on Generalization in the manual:
https://osm2pgsql.org/doc/manual.html#generalization

For the raster support this adds two new library dependency: CImg and potrace. Both have been around for a long time and are readily available on all systems.

The following strategies work on a tile-by-tile basis and operate on polygons:

The "vector-union" strategy buffers and unionizes polygons using vector operations.

The "raster-union" strategy does a similar thing but does it in raster space which is much faster. First the polygons are rendered into a raster, an open/close operation is called (which basically does the same thing as the buffering in vector space) and finally the resulting raster is vectorized again.

The "builtup" strategy is intended to derive a layer of builtup areas from landuse=residential/industrial etc. as well as building cover and dense road networks.

The following strategies always work on all data (not tile-based):

The "discrete-isolation" strategy rates places based on some importance metric to get a more even distribution of places on the map.

The new "rivers" strategy finds important rivers, this is still very much work in progress.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/osm2pgsql/pull/1942

-- Commit Summary --

  * Add support for data generalization

-- File Changes --

    M .github/actions/ubuntu-prerequisites/action.yml (2)
    M .github/actions/win-install/action.yml (3)
    M .github/workflows/ci.yml (4)
    M .github/workflows/test-install.yml (2)
    M CMakeLists.txt (34)
    M README.md (5)
    M docs/CMakeLists.txt (11)
    A docs/osm2pgsql-gen.md (88)
    A src/gen/canvas.cpp (130)
    A src/gen/canvas.hpp (88)
    A src/gen/gen-base.cpp (108)
    A src/gen/gen-base.hpp (95)
    A src/gen/gen-create.cpp (45)
    A src/gen/gen-create.hpp (26)
    A src/gen/gen-discrete-isolation.cpp (147)
    A src/gen/gen-discrete-isolation.hpp (37)
    A src/gen/gen-rivers.cpp (347)
    A src/gen/gen-rivers.hpp (43)
    A src/gen/gen-tile-builtup.cpp (280)
    A src/gen/gen-tile-builtup.hpp (52)
    A src/gen/gen-tile-raster.cpp (249)
    A src/gen/gen-tile-raster.hpp (49)
    A src/gen/gen-tile-vector.cpp (94)
    A src/gen/gen-tile-vector.hpp (37)
    A src/gen/gen-tile.cpp (49)
    A src/gen/gen-tile.hpp (36)
    A src/gen/osm2pgsql-gen.cpp (683)
    A src/gen/params.cpp (125)
    A src/gen/params.hpp (96)
    A src/gen/raster.cpp (66)
    A src/gen/raster.hpp (64)
    A src/gen/tracer.cpp (108)
    A src/gen/tracer.hpp (76)

-- Patch Links --

https://github.com/openstreetmap/osm2pgsql/pull/1942.patch
https://github.com/openstreetmap/osm2pgsql/pull/1942.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1942
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/osm2pgsql/pull/1942 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20230302/b6a4cc7e/attachment.htm>


More information about the Tile-serving mailing list