Skip to content

Releases: osm2pgsql-dev/osm2pgsql

Release 1.11.0

12 Feb 16:25
Compare
Choose a tag to compare

This release makes the new middle database format the default. If you have not switched already, you need to reimport your database to take advantage of that.

We have changed the way we are parsing the command line options. The new code uses the CLI11 library (a copy of which is included in the repository) and is much cleaner and also much stricter. You now get warnings (and sometimes errors) for many combinations of options that don't make sense. Please check the output from osm2pgsql and osm2pgsql-replication for such messages and fix your command lines accordingly. Note especially that duplicated options are not allowed any more. This can happen, for instance, when using osm2pgsql-replication which adds the database connection parameters (such as -d) when it calls osm2pgsql.

If all goes well this will be the last release starting with a 1. We are planning for a version 2.0.0 in the second quarter of 2024. In that release we will remove all the functionality that has been deprecated. We will also remove support for the legacy database middle format and only support the new format introduced in version 1.9.0.

Further changes:

  • The number of database connections that osm2pgsql was opening could be quite large as it was depending on the number of tables. This is no longer the case. Osm2pgsql is opening far fewer connections now, usually you will not need to change the PostgreSQL max_connections settings any more.
  • Osm2pgsql now adds the context (the part of osm2pgsql responsible for a database connection) and the connection number to the application name used in the database connection. This allows you to better monitor what osm2pgsql is doing using the pg_stat_activity table in the database.
  • Bugfix: Using the new database format with -x, --extra-attributes did not work due to a wrong SQL command. This is fixed now.

Many thanks to Thunderforest who supported development of the features in this release.

Release 1.10.0

07 Nov 16:37
Compare
Choose a tag to compare

This is a relatively small but still important release.

The new middle table format has changed slightly: the tags field can now be NULL. This makes storage more efficient and indexing faster. The new middle format is now declared stable and production ready. To use it, use the command line option --middle-database-format=new, in a future version of osm2pgsql this will become the new default. If you have used this option already with one of the 1.9.x versions of osm2pgsql you have to reload your database or use this SQL command to update the table: ALTER TABLE <name> ALTER COLUMN tags DROP NOT NULL;, for <name> use planet_osm_nodes, planet_osm_ways, and planet_osm_rels or the equivalents if you are using a different table name prefix.

Other changes:

  • Emit a warning that the flex output area type and the add_row() functions are deprecated if you use them. If you get this warning, read https://osm2pgsql.org/doc/tutorials/switching-from-add-row-to-insert/ .
  • Add first/last timestamps to expire tables. Having these timestamps allows various expire/updating strategies.
  • The docs directory is now called man, because it only contains the man pages. All other docs are on the project web site.
  • Various improvements on the (still experimental) generalization code. The biggest change is that we switch from using the CImg to the OpenCV library which makes the code an order of magnitude faster.

Release 1.9.2

04 Sep 12:14
Compare
Choose a tag to compare

This release fixes a bug introduced in 1.9.0 with two-stage processing that will lead to crashes. If you are using any 1.9.x version, please upgrade to 1.9.2.

In one case we had some performance problems updating an osm2pgsql database with 1.9.1 due to the PostgreSQL query planning choosing a bad plan. This release contains a workaround for that problem.

We also improved the (experimental) generalizer code a bit:

  • More information is shown in log level 'info', including some timing information.
  • The Lua config run_sql() command now can have either a single SQL statement in the sql field (as before) or a list of SQL commands.
  • For convenience, the Lua config run_sql() command now has an optional transaction field which can be set to true to wrap the SQL commands in BEGIN/COMMIT.
  • The new if_has_rows fields on the run_sql() command can be set to string with an SQL query. If that field is set, the SQL statement(s) in the sql field is only run, if the SQL query returns at least one row.
  • Some performance improvements in low-level code in the generalizer.

Release 1.9.1

22 Aug 15:14
Compare
Choose a tag to compare

This release fixes some small issues with 1.9.0:

  • Fix compatibility of osm2pgsql-replication with psycopg3
  • Fix architecture-dependent double to integer conversion
  • Some small code cleanups

Release 1.9.0

15 Aug 20:59
Compare
Choose a tag to compare

This release brings three new major features:

  • a new osm2pgsql_properties table that saves command line options and reuses them on updates
  • a new database middle saves raw OSM data in JSONB format and is explicitly designed to be queried by the user
  • the new (and still experimental) osm2pgsql-gen adds geometry generalization to osm2pgsql (thanks @joto)

Other changes include:

  • cleanup of schema handling
  • tile expiry output into database tables
  • a new spherical_area() function for flex config files to calculate the area of a (multi)polygon on the sphere.
  • when using the new database middle, the --middle-with-nodes option allows you to store all tagged nodes in the database (with their tags and location).
  • several improvements to osm2pgsql-replication to make it more flexible and better tested (thanks to @amandasaurus and @JakobMiksch)
  • don't do multi-statement SQL queries to be compatible with the PgPool-II connection pooler.

Please note that this version drops support for implicit DB schema other than public. If you rely on implict user schemas or custom schema paths, you now must configure the schema to be used with the --schema option.

To compile osm2pgsql some new libraries are needed, please see the README.md for details.

For more information on all new features and changes read the more extensive release notes for 1.9.0.

Release 1.8.1

13 Feb 10:14
Compare
Choose a tag to compare

This release contains some fixes and minor changes.

  • Fix osm2pgsql-replication script so it works correctly with PostgreSQL schemas.
  • Don't process objects without tags in outputs in append mode. This should speed up updates a little bit.
  • Count number of inserted rows and rows not inserted because of NOT NULL constraints for each table and log the numbers in debug mode.
  • Remove some extra-verbose debug logging when using the pole_of_inaccessibility() function.
  • Flush output tables generated from nodes and ways tables earlier.

Release 1.8.0

28 Jan 10:44
Compare
Choose a tag to compare

The largest change is the addition of much more flexible index support in the flex output. The table definitions have a new (optional) field called indexes now which takes a list of index definitions. If the field is not there, we fall back to what we did before and create a GIST index on the only/first geometry column of a table. But you can also define any kind of index you want: define which index method (BTREE, GIST, ...) to use on which columns, define WHERE clauses and expression indexes and much more. See the flex-config/indexes.lua Lua config for some usage examples and the manual for all the details. You can also force osm2pgsql to always build the id indexes which are normally only built in slim mode.

The gazetteer output and the command line option --with-forward-dependencies are deprecated in this release and will be removed soon. They were only needed for Nominatim which switched to using the flex output recently.

Here are the other changes:

  • Fix a problem when using osm2pgsql with a projection other than WGS84 (EPSG:4326) or Web Mercator (EPSG:3857) which made the program really slow.
  • New pole_of_inaccessibility() Lua function to generate reasonably good label points from polygons. (This function is currently marked as experimental, which means it can change without notice at any time.)
  • Performance improvement for very small updates. Don't spin up multiple threads when there are less then 100 objects to process, because the extra overhead is not worth it.
  • Implement and use our own JSON writer. This removes the dependency on RapidJSON which hasn't seen a new release since 2016.
  • Add more checks (or does some checks earlier) to make sure your database uses UTF-8 encoding and that necessary database extensions are loaded and index methods, schemas and tablespaces you refer to in the config are actually available.
  • A lot of code needed to be updated so it works correctly with any of the recent versions of the fmt library.

As always there were lots of code cleanups across the board, but especially in code accessing the database and in the C++/Lua glue code to make it more flexible and easier to use internally.

Release 1.7.2

10 Nov 20:34
Compare
Choose a tag to compare

This release has some small changes only:

  • The flex output now allows tables with only the id column (or columns).
  • The osm2pgsql-replication script now always expects the osm2pgsql binary to be in same path as itself.
  • Adds the flag --middle-schema=SCHEMA to the osm2pgsql-replication script which allows placing the replication status table in a schema other than PUBLIC (Thanks to @JakobMiksch).
  • More tests have been converted to the new BDD format.
  • Various code cleanups and refactorings especially in the expire code.

Release 1.7.1

04 Oct 19:00
Compare
Choose a tag to compare

This release fixes a few small bugs in osm2pgsql and closes some gaps in the geometry processing code released in 1.7.0. It also contains some security-related fixes as a result of the security audit.

  • Added as_multipoint() function to complement as_multilinestring() and as_multipolygon().
  • The functions as_multipoint(), as_multilinestring(), and as_multipolygon() will now always return single geometries if possible. Single geometries are always allowed where multi geometries are allowed, so this does't break anything.
  • The centroid() function now works for all geometry types.
  • New length() function to compute the length of a geometry in map units.
  • New reverse() function to turn geometries around (can be useful for ways tagged with oneway=-1).
  • The simplify() function is now available for multilinestrings, too. (Not for polygons yet.)
  • All example code in the flex-config directory has been updated for the new geometry handling capabilities.
  • Create nicer error messages when trying to access a missing database extension, schema, or tablespace.
  • Better checking of names (of tables, schemas, etc.) used in SQL in osm2pgsql and osm2pgsql-replication to avoid potentional SQL injection issues.
  • Fix: Make sure relation members show up in the correct order in multi-geometries when using slim mode.
  • Fix: Do not try to run ST_IsValid() on create_only columns.
  • osm2pgsql-replication: The database parameter may be empty when connection parameters are supplied via environment variables.
  • osm2pgsql-replication: when installed, now runs the osm2pgsql binary that was installed with it to avoid potential security issues through PATH manipulation.
  • osm2pgsql-replication: Meaningful error when middle tables do not exist or the prefix is a bad one.

Release 1.7.0

15 Aug 07:39
Compare
Choose a tag to compare

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 function insert() 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 files addresses.lua, generic.lua, simple.lua and geometries-using-insert.lua in the flex-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.