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

Is there a way to delete just one region from a postgresql-gis database that was downloaded from and imported using osm2pgsql?

...or to truncate all data from the necessary tables and start over with a fresh/empty database/table?

I followed the instructions at switch2osm and imported North American sub-region data (.osm.pbf) from for the state of Maine using osm2pgsql.

They also have "special" sub regions for the entire US Northeast, which they say "may duplicate data already contained in the other sub regions".

Now that I know how to do it, I'd rather get rid of the Maine data from maine-latest.osm.pbf and replace it with the us-northeast-latest.osm.pbf data.

Is there a straightforward way to do this that I'm overlooking in the docs?

asked 04 Mar '19, 22:43

Sareneathenodny's gravatar image

accept rate: 0%

edited 04 Mar '19, 22:44

Actually, if you import a new region by default it'll remove any previous data, so you may not need to do anything.

permanent link

answered 04 Mar '19, 22:50

SomeoneElse's gravatar image

SomeoneElse ♦
accept rate: 16%

Is that true for non-overlapping regions too? If I download and import north-america-latest.osm.pbf, then as a second, separate step import download and import central-america-latest.osm.pbf, will the data for North America be gone?

(04 Mar '19, 22:57) Sareneathenodny

Yes, the default action is "create" (which will remove previous data). "append" is available (but is very slow) if you really do want to append, and that can have problems due to unexpected overlaps between the two areas (think ferry routes).

If you want to upload two areas it's probably best to merge first and then load that.

(04 Mar '19, 22:59) SomeoneElse ♦

Ah. I see. My thought was to import the 5 separate US-subregions from geofabrik to get a map for just the USA, to save on disk space. So you're saying that could cause issues at the boundaries and that it would be best from a technical standpoint to just get the whole north-america file?

(04 Mar '19, 23:09) Sareneathenodny

If what you ultimately want is the whole of North America, yes. If you just want some subregions, combine them with osmosis or similar and load the result.

(05 Mar '19, 19:13) SomeoneElse ♦

Great, thanks!

(05 Mar '19, 20:06) Sareneathenodny

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 04 Mar '19, 22:43

question was seen: 1,952 times

last updated: 06 Mar '19, 09:00

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