NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi,

I am using osm2pgsql to import full OSM into PostgreSQL and is there any way to exclude some tables during the importing?

I just want to import the planet_osm_polygon table only and exclude the planet_osm_line , planet_osm_point and planet_osm_roads tables.

Really appreciate any help.

asked 28 Aug '17, 04:20

xiaoweishen's gravatar image

xiaoweishen
66225
accept rate: 0%


The _ways and _node tables are only used for "-slim" imports, if your machine has enough memory or you are only importing a small extract you can try the import without the -slim option.

Note a further way to save space is to use a normal file for node storage instead of the database table.

the above notes are not directly relevant for the specific question

Outside of the above you can simply edit the default.style file to control what gets imported and what not. There is no exact one to one relationship between OSM elements and tables in the osm2pgsql schema so asking to "exclude" tables doesn't make much sense. You can naturally simply drop any tables you don't want post import (assuming this is a one-off import)

See http://wiki.openstreetmap.org/wiki/Osm2pgsql and https://github.com/openstreetmap/osm2pgsql/blob/master/README.md for more information.

It should be noted that this help site is not intended as a way to find people that can google for you, but far more for questions with non-obvious answers that cannot be easily found simply by reading the documentation.

permanent link

answered 28 Aug '17, 08:55

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

edited 28 Aug '17, 10:33

Hi Simon, Thanks for your reply firstly. What you given are obvious notes for osm2pgsql and I certainly have read lot of this. What I want is just to try to find out how to exclude tables during importing, something like the options exclude... of Oracle import. BTW, you said the _line and _point are only used for "-slim" mode, I suggest you mean _nodes and _ways.

Anyway, there are four tables basicly will be imported by osm2pgsql, including planet_osm_line, planet_osm_point, planet_osm_polygon and planet_osm_roads, no matter what you are using "-slim" mode or not. I just want to import planet_osm_polygon only. You have no answers about my question.

Thanks.

(28 Aug '17, 09:09) xiaoweishen

I do not care aboud the disk and RAM size. Just want to import the specified table and ignore the others.

(28 Aug '17, 09:13) xiaoweishen
1

Edit the default.style to only include the objects you want (you won't be able to completely get rid of the other tables likely due to how some of the polygon building works).

(28 Aug '17, 09:51) SimonPoole ♦

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:

×710
×196
×165

question asked: 28 Aug '17, 04:20

question was seen: 2,790 times

last updated: 28 Aug '17, 10:33

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum