I'm trying to import a relation of type multipolygon into a PostGreSQL DB using osm2pgsql.

I use the result of this query as OSM file: http://overpass-turbo.eu/s/G7r which contains one way https://www.openstreetmap.org/way/25210902 and one relation https://www.openstreetmap.org/way/25210902 with the default.style and this command: osm2pgsql --slim --username xy --database gis --style default.style export.osm

While the way item is going nicely into the table planet_osm_polygon, the relation doesn't import into planet_osm_polygon (or any other table), but is present in planet_osm_rels.

Also, there seems to be no error in the shape of the relation which would prevent the import, as checked on http://tools.geofabrik.de/osmi/?view=areas&lon=9.59871&lat=47.23608&zoom=16

My question: Is it by design that multipolygons do not end up in planet_osm_polygon or do I have to change the default.style or is there a problem with relation 1697460 (Although I also tested other multipolygon relations with the same (negative) result.)

asked 14 Feb, 15:46

r1tter's gravatar image

r1tter
51113
accept rate: 100%

edited 16 Feb, 08:59

aseerel4c26's gravatar image

aseerel4c26 ♦
32.1k16239551


OK, the problem was the order of the data in the OSM XML file provided by overpass-turbo.eu (I selected "Export/Data/Download as raw OSM Data): When the relations appear BEFORE the nodes and ways, the relations won't be imported into planet_osm_polygon by osm2pgsql. Putting the relations AFTER the nodes and ways solved therefor the problem.

(Importing the OSM XML from overpass-turbo to level0.osmz.ru and then exporting the data as OSM corrected the order, btw)

permanent link

answered 15 Feb, 15:27

r1tter's gravatar image

r1tter
51113
accept rate: 100%

thanks for the self-answer! Is there anything left unclear or can we close this question?

(15 Feb, 20:59) aseerel4c26 ♦

You can close it. Thanks!

(16 Feb, 06:48) r1tter
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×213
×190
×125
×108

question asked: 14 Feb, 15:46

question was seen: 501 times

last updated: 16 Feb, 08:59

powered by OSQA