## Expire

Quick and efficient expire and re-rendering of tiles with changed data is 
important for OSM. Historically osm2pgsql didn't do a great job figuring out 
which tiles are affected by some change. Quite some work went into this release 
to improve that situation. Most importantly polygons are now not expired by 
bounding box any more but the shape of the polygon is taken into account. For
large polygons with weird shapes, this can make quite a difference.

A larger refactoring was needed to be able to support "diff expire": When an 
object changes, we used to always expire all tiles intersecting the old or the 
new geometry of an object. We can now expire tiles based on the *symmetric 
difference* between old and new geometry. A small change in, say, a large lake 
will then only affect the tile(s) covering that small change, not the whole
area. This feature has to be enabled using the `diff_expire = true` setting in 
the table definition.

The number of tiles to be expired can be quite large if the input geometries 
are large or if there are many geometries. Numbers of tiles in the billions can 
crash osm2pgsql because it runs out of memory. Such large numbers can also 
overwhelm any kind of re-rendering mechanism run after osm2pgsql to bring tiles 
up to date. In day-to-day processing this should not happen, but it can happen 
due to vandalism or misconfiguration.

To protect against this problem, this version introduces limits on the number 
of tiles that can be affected by a single geometry and the overall number of 
tiles that an expire output will generate for each run of osm2pgsql. Defaults 
for these limits are quite high to not negatively affect existing setups. It is 
recommended to review and adapt the limits for each expire output based on your 
configuration and expire processing.

Overall the code related to expire processing is much cleaner and some bugs in 
corner-cases were removed.

## Style Tester

The newly added tool osm2pgsql-test-style allows you to test your Lua style 
file using a BDD-style testing language. osm2pgsql has tested its own styles 
and functionality with such BDD tests for a long time. We've cleaned up the 
code of the framework behind these tests and moved it into its own stand-alone 
file, so it can now be used externally.

## New Id Cache Function

It is sometimes useful to process tagged nodes together with the ways they are 
on. Examples are barrier tags on highways (such as a lift gate) or a ford in a 
river. On some maps, the size and orientation of the "lift gate" or the "ford" 
symbol depends on the type and geometry of the way it is on.

Doing the processing for this is possible in PostGIS, but not easy and not 
cheap. So we added some functionality to osm2pgsql to help with this: When 
processing nodes, you instruct osm2pgsql in the Lua config file to store the 
Ids of some nodes (for instance with the "ford=yes" tag) in the "Id cache". 
Later, when processing the ways this information can be retrieved and used to 
store the node together with the way geometry or do other processing.

Thanks to @dch0ph for bringing up this issue and testing the implementation.

## Geometry Processing

We are adding more and more functionality around geometries to osm2pgsql 
accessible from the Lua config file. It is more convenient and often much 
faster to do this processing while the data is being imported instead of inside 
the database later on.

* Function `:as_point(n)` can now be used to create a point geometry from an 
OSM way object. The parameter `n` is the 1-based index of the member nodes.
* The `spherical_area()` function was changed to use the spheroid instead of a 
sphere, it now returns the same value as `ST_Sphere(geography, use_spheroid = 
true)`.
* A `spherical_length()` function was added.
* Geometries can now be checked for equality in Lua using the `==` operator.
* New `n_points()` function to get the number of points in any geometry.

## The Rest...

There are lots of smaller fixes, cleanups, improvements and other changes:

* Tile-based generalizer strategies now support an option `max_tiles_per_run` 
to limit the number of tiles processed per run to spread the update load over a 
longer time.
* More PostgreSQL data types are supported: `double precision`, and `timestamp` 
(with or without time zone). Thanks to @amandasaurus for the `double precision` 
PR.
* Some command line option values/combinations that have so far only shown 
warnings, will now stop osm2pgsql with an error.
* The minimum PostgreSQL version supported is 12.
* Fix: `osm2pgsql-expire` is now installed on `make install`.
* Fix: Handle case where raster-union generalizer is used without group-by.

-- 
View it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/releases/tag/2.3.0
You are receiving this because you are subscribed to this thread.

Message ID: <osm2pgsql-dev/osm2pgsql/releases/[email protected]>
_______________________________________________
Tile-serving mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/tile-serving

Reply via email to