OSM2PGSQL - Missing MultiPolygons

Hi all

I have loaded a full planet import into Postgres and I am coming across occurrences where some multipolygons are not getting imported into the planet_osm_polygons table. They do however exist in the planet_osm_rels table

This is my import command: (version 0.96 - style sheet is default)


osm2pgsql -v -l --unlogged --create --slim -C 50000 --number-processes 6 --multi-geometry --flat-nodes planet.nodes --extra-attributes -S /usr/local/share/osm2pgsql/default_timestamp_version.style --hstore -d osm_planet -U osm planet-latest.osm.pbf  

An example of a Multipolygon that isn’t getting imported is here (but we have come across several others):

https://www.openstreetmap.org/relation/3923874#map=19/28.37060/-81.55709


➤ psql://postgres@myosmtest.co.uk:5432/osm_planet

# select * from planet_osm_rels where id = 3923874 ;

│ id          │ 3923874     
│ way_off     │ 0
│ rel_off     │ 6
│ parts       │ {295168237,295168242,295168243,295166640,295166202,295166639}   
│ members     │ {w295168237,outer,w295168242,inner,w295168243,inner,w295166640,inner,w295166202,inner,w295166639,inner}                                                               │
│ tags        │ {lit,yes,type,multipolygon,highway,pedestrian,surface,paved,osm_user,Memoire,osm_uid,2176227,osm_version,5,osm_timestamp,2017-05-13T19:57:53Z,osm_changeset,48658396} │


I have checked the lines, roads & polygons tables and the features are not getting created in any of these tables. Can anyone spot anything simple I have missed? Or is this a problem with osm2pgsql? There are many Multipolygons successfully imported - but quite a few simply don’t get created.

Is this something to do with “old style” multipolygons? if so, how do I get these to import correctly?

Any help appreciated!

Thanks,

Mike

Looking at the particular example you linked, I initially thought this was going to be an easy one, as it appeared an inner way was touching the outline / outer way. However, on closer inspection, this is in fact not the case, all the inners are separated from the outer, just with a very small gap.

JOSM’s validator and OSM Inspector also consider the multipolygon you linked valid, there are no issues listed.

So this indeed leaves a question mark as to why you couldn’t get this particular one imported…

there is nothing wrong with this MP - and is excisting in planet_osm_polygon:


select osm_id,tags, way_area from planet_osm_polygon 
 where osm_id=-3923874;

  osm_id  |                                                                                                             tags                                                                                                             |  way_area   
----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------
 -3923874 | "lit"=>"yes", "highway"=>"pedestrian", "surface"=>"paved", "way_area"=>"4.36307e-07", "osm_version"=>"7", "osm_changeset"=>"62106229", "osm_timestamp"=>"2018-08-29T13:56:42Z" | 4.36307e-07
(1 Zeile)

max be you missed the negative id?

Regards
walter

Hi all

Thanks for the replies.

The polygons are simply not getting added to the polygon table (using --multi-geometry or not) and also not with negative id’s. I have visually inspected the polygon table and they are simply not getting added.

Am I missing a processing step?

Here are 2 more examples:

https://www.openstreetmap.org/relation/5325528

https://www.openstreetmap.org/relation/5325529


➤ psql://postgres@myosmtest.co.uk:5432/osm_master

# select id, parts, members, tags from planet_osm_rels where id in ( 5325528, 5325529 ) ;
┌─────────┬───────────────────────┬─────────────────────────────────────┬──────────────────────────────────────────────────────────┐
│   id    │         parts         │               members               │                           tags                           │
├─────────┼───────────────────────┼─────────────────────────────────────┼──────────────────────────────────────────────────────────┤
│ 5325528 │ {238954867,356904844} │ {w238954867,outer,w356904844,inner} │ {type,multipolygon,highway,pedestrian,osm_user,"Peter Br…│
│         │                       │                                     │…emer",osm_uid,366321,osm_version,1,osm_timestamp,2015-06…│
│         │                       │                                     │…-28T09:10:26Z,osm_changeset,32258639}                    │
│ 5325529 │ {238954865,356904845} │ {w238954865,outer,w356904845,inner} │ {type,multipolygon,highway,pedestrian,osm_user,"Peter Br…│
│         │                       │                                     │…emer",osm_uid,366321,osm_version,1,osm_timestamp,2015-06…│
│         │                       │                                     │…-28T09:10:26Z,osm_changeset,32258639}                    │
└─────────┴───────────────────────┴─────────────────────────────────────┴──────────────────────────────────────────────────────────┘


➤ psql://postgres@myosmtest.co.uk:5432/osm_master

# select * from planet_osm_polygon  where osm_id in (5325528, 5325529, -5325528, -5325529) ;
(0 rows)

But there are definetly Multipolygons getting through the the planet_osm_polygon table:


➤ psql://postgres@myosmtest.co.uk:5432/osm_master

# select count(*) from planet_osm_polygon where geometrytype(way) = 'MULTIPOLYGON' ;
┌────────┐
│ count  │
├────────┤
│ 138369 │
└────────┘

no area=yes ? ( highway=pedestrian +** area=yes** )

for pedestrian zone :

this key is included in the carto - polygon_keys ( “Objects with any of the following keys will be treated as polygon” )

don’t forget to add –tag-transform-script openstreetmap-carto.lua" option.
see more: https://github.com/gravitystorm/openstreetmap-carto/blob/master/INSTALL.md

Best,
Imre