Version 1.7.0
Released: 2022-08-15
For this version we rebuilt a lot of the code around geometry processing and around expire. The different parts – creation of geometries from OSM data, transforming geometries (like merging and splitting linestrings) and finally writing them out in WKB format for import into the database – are now well separated and tested on their own. And we added some functions for geometry processing, too. osm2pgsql can now calculate the centroid of a polygon and simplify linestrings using the Douglas-Peucker algorithm.
But the best part is that all of that new geometry goodness is now available from the Lua config files when using the flex output. There are many new ways of processing geometries from Lua:
- The get_bbox() is now available for relations, too.
- There are new functions as_point(), as_linestring(), as_polygon(), as_multilinestring(), as_multipolygon(), and as_geometrycollection() to create geometries from OSM objects.
- Geometries can be manipulated in Lua with several functions modeled after the same functions in PostGIS: area(), centroid(), geometry_type(), line_merge(), num_geometries(), segmentize(), simplify(), srid(), and transform(). We expect more to come in the future. This way you can do more geometry processing on import removing the need for some post-processing in SQL.
- We used to have the somewhat magic handling of geometries with the
add_row()
function which only allowed a limited set of operations. This function is still available for backwards compatibility, but there is a new functioninsert()
now which doesn’t have this magic. Instead geometries are treated like any other data type giving you a lot more flexiblity. Check out the example config filesaddresses.lua
,generic.lua
,simple.lua
andgeometries-using-insert.lua
in theflex-config
directory for some ideas on what can be done.
In this version we enabled the bucket index for way nodes by default. This had been around for a while but you needed a command line option to enable it. After some positive feedback from the community we decided to make this the new default. It will be used on new imports (existing databases will keep using the old index). The new bucket index is much smaller and can save you hundreds of gigabytes of disk space. See https://osm2pgsql.org/doc/manual.html#bucket-index-for-slim-mode for the details.
And again a lot of code cleanups and some smaller bug fixes went into this release. To make writing tests easier we added a new BDD testing framework based on behave (https://behave.readthedocs.io/) and re-wrote a lot of the existing tests. Writing tests is now much easier and a lot less tedious.
There are also a bunch of changes to the osm2pgsql-replication script to make it easier to use.
This is the first version of osm2pgsql that needs a C++17 compiler. And there is a new dependency on the boost::geometry library.