osm2pgsql-dev / osm2pgsql

OpenStreetMap data to PostgreSQL converter
https://osm2pgsql.org
GNU General Public License v2.0
1.51k stars 474 forks source link

Chunky rivers when generalizing water areas #2087

Open pnorman opened 1 year ago

pnorman commented 1 year ago

What version of osm2pgsql are you using?

1.9.2-29-g374eca48

What did you do exactly?

I am generalizing water tables with themepark and osm2pgsql-gen

osm2pgsql.run_gen('raster-union', {
    schema = themepark.options.schema,
    name = 'water_z12',
    dest_table = 'water_z12',
    src_table = 'water',
    zoom = level
})
osm2pgsql.run_gen('raster-union', {
    schema = themepark.options.schema,
    name = 'water_z8',
    dest_table = 'water_z8',
    src_table = 'water',
    zoom = level
})

What did you expect to happen?

I expected generalized tables that would be useful at z8 and z12.

What did happen instead?

At z8, the water areas are "chunky" when using the z8 table image

This is rendered at 1 z8 tile = 512 device independent pixels

It's not really any better at z7 image

Loading it in QGIs shows large chunks of rivers missing

image

I found a smaller river and looked at at z12, and similar problems are observed but they're not as severe

image

What did you do to try analyzing the problem?

I could see needing to adjust the zoom levels where the generalized tables start to be used by one, because the defaults could have been set for 256px tiles. But I tried that by looking at z7, and it was still a problem.

I tried a 25% buffer_size, and a 4096px image_extent. The latter helped slightly, but it was still a problem.

joto commented 1 year ago

You have to play around with zoom levels and extent to get this right. The zoom levels mentioned in the generalizer config are not necessarily the same zoom levels you generate the generalization for. They are merely used to decide how to cut the world for the generalization process.

pnorman commented 1 year ago

We should aim for the defaults to generally be a good starting place. I'm working my way through the different types of polygons, but at least for water, I don't think they are.

I've had some success with adjusting the buffer_size, and I think this is why the different image_extent worked - instead of being a buffer of 10/2048 of a tile, it was 10/4096.