Skip to content

Tags: osm2pgsql-dev/osm2pgsql

Tags

1.8.0

Toggle 1.8.0's commit message
Release 1.8.0

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.

1.7.2

Toggle 1.7.2's commit message
Release 1.7.2

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.

1.7.1

Toggle 1.7.1's commit message
Release 1.7.1

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](https://osm2pgsql.org/news/2022/09/13/security-audit.html).

* 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.

1.7.0

Toggle 1.7.0's commit message
Release 1.7.0

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.

1.6.0

Toggle 1.6.0's commit message
Release 1.6.0

* The osm2pgsql-replication script which has been included in the osm2pgsql
  repository for a while will now be installed together with its man page on
  "make install". To use it you need Python3, psycopg2 (or psycopg3), and
  PyOsmium installed.
* Ignore relations with more than 32.000 members (which should never happen
  in real data) instead of failing.
* Removed the dependency on boost::algorithm.
* Included libosmium was updated to newest version 2.17.3 which contains
  an important fix for a problem which can lead to osm2pgsql locking up.

1.5.2

Toggle 1.5.2's commit message
Version 1.5.2

This is a bugfix release with only minor changes.

Changes:

* Fix parsing problems in style file reader. Some variables were not
  initialized correctly when parsing a style file, which lead to some
  surprising behaviour with flags of one config line re-used by the next
  if the flags field of that line was empty. This could also have lead to
  buffer overflows in the first line being parsed.
* Fix: When there is an active progress display, log messages would show up
  after the progress display instead of the next line.
* Release some allocated memory earlier in the processing chain.
* Fix confusing log message: The message "Done postprocessing on table '{}'
  in {}" was logged twice when `--drop` is used. This changes one of the log
  messages to the more specific "Table '{}' dropped in {}".
* Run ANALYZE on middle tables only in create mode saving some processing
  time.
* Add 'status' command to `osm2pgsql-replication`. Prints the current
  replication status, and with `--json` prints that as JSON data.
* Needs at least CMake 3.5.0 now.
* Updates the included versions of the catch2, fmt, libosmium, and protozero
  libraries to current versions.

Note that this is the last version which will compile with C++14. The next
version 1.6.0 will need C++17.

1.5.1

Toggle 1.5.1's commit message
Release 1.5.1

This is a bugfix release. It contains some important bug fixes,
so averybody is encouraged to update.

Here are the changes:

* When importing a planet file or a huge extract, something with
  more than about 1 billion nodes, the new RAM node location
  store could overflow a 32bit "offset" value which meant that
  the node locations would not be found again. The result were
  missing features, because osm2pgsql just ignores features with
  geometries that can not be built due to missing node locations.
* Osm2pgsql creates temporary tables as `UNLOGGED` to get better
  performance. We fixed a bug where non-temporary output tables
  were also created as `UNLOGGED` (when clustering was disabled.)
* In the flex output table columns marked `create_only` are now
  only created in final tables, not temporary tables. This avoids
  some problems, for instance when using columnn type `SERIAL`.
* Make the input data check more strict: Two versions of same
  object are not allowed in the input.
* Remove `IMMUTABLE` volatility classification from validity check
  trigger function.
* Make the directory where the config file is available in the
  flex output through the `osm2pgsql.config_dir` global Lua variable.
* Update required libosmium version to 2.17.0. The version 1.5.0
  already required this, but it wasn't documented.

1.5.0

Toggle 1.5.0's commit message
Release 1.5.0

This release brings quite a lot of improvements. We removed the "experimental"
label from the flex output which we introduced in version 1.3.0. There are some
small changes you might have to make to your flex configurations, see the
[Upgrading](https://osm2pgsql.org/doc/manual.html#upgrading) chapter of the
manual for details.

This release also contains a rewrite of the code used to temporarily store
OSM data in memory while processing the data in non-slim mode, i.e. when you
import data without `--slim`. It now uses much less memory.

Other changes:

* The multi output which was marked as deprecated in the last versions has now
  been removed.
* This is the first release that needs a C++14 compiler.
* New [`cluster` table
  option](https://osm2pgsql.org/doc/manual.html#advanced-table-definition) in
  the flex config file which allows you to disable clustering of the table data
  by geometry.
* Do not try to create indexes for flex output tables without id.
* Added flex config example (`attributes.lua`) showing how to access
  OSM object attributes (such as timestamp, user name, etc.) from Lua.
* Added a warning if `--flat-nodes/-F` is used in non-slim mode.
* Report cache memory usage when running with `--log-level=debug`.
* Report thread number in all log lines when `--log-level=debug` is set.
* Use trigger to check geometry validity on first import instead of only doing
  this when copying the data for clustering. In the flex output this validity
  check is not used any more for point geometries because they are always
  valid anyway.
* The [RapidJSON](https://rapidjson.org) library is now used and included
  in the source.
* Now needs [libosmium](https://osmcode.org/libosmium/) 2.17.0 which is
  included in the source.
* Lots of internal cleanups and restructurings.

1.4.2

Toggle 1.4.2's commit message
prepare release 1.4.2

1.4.1

Toggle 1.4.1's commit message
Release 1.4.1

This is a minor release with some bug fixes and internal cleanups and changes,
mostly in the "middle" code and geometry processing.

We have released all example config files for the flex output into the Public
Domain, so they can be used as widely as possible.

Fixes:

* Some MultiLineStrings were not assembled correctly from relations. This
  happened when a relation had exactly two member ways forming a closed ring
  with the two ways oriented against each other (#1394).
* Long LineStrings can (optionally) be split by osm2pgsql into shorter
  segments. In some cases this would produce invalid LineStrings (aee1be1).
* Do not try to display ANSI color codes on Windows terminals which don't
  understand them (ab96aeb).

Other changes:

* When osm2pgsql is started without any arguments, it now shows the help text
  instead of an error.
* Write PostGIS version to output when osm2pgsql starts up and show error
  message when a database without PostGIS extension is used (c7927e8, #1400).
* Improved progress output and summary information when processing input files.
* Add log entry with number of threads when thread pool is started (34cf9d8).
* Report overall memory usage at the end of running osm2pgsql.
* Updated included library versions (fmt 7.1.3, libosmium 2.16.0, catch 2.13.4).