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

Hello,

How do I add a few selected countries only instead of adding the planet data? I used the following to add one,

osm2pgsql --slim -d gis --hstore --multi-geometry --number-processes 10 --tag-transform-script /home/osm/openstreetmap-carto/openstreetmap-carto.lua --style /home/osm/openstreetmap-carto/openstreetmap-carto.style -C 32000 /home/osm/qatar-latest.osm.pbf

Can I use the same command and add another one or am I doing something wrong?

asked 28 Jul '22, 09:21

praveen_aps's gravatar image

praveen_aps
16113
accept rate: 0%

edited 30 Jul '22, 05:13


The safest approach is downloading a continent or planet file, then using osmium to cut out the area that interests you, resulting in one single file to import, then import that.

Alternatively, download individual countries, merge them with osmium, resulting in one single file, then import that.

Importing individual countries one after the other is not recommended, it is much slower than the approaches above.

permanent link

answered 28 Jul '22, 09:32

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Thanks for your response, although may I ask if there's any drawback to doing so apart from it being slower? because we'd like to add more countries as and when required.

(28 Jul '22, 09:57) praveen_aps
2

Being slower is the only drawback but depending on your setup you will find that it can take two weeks to add a country that way when it would take two hours to do a full import on a clean database. Just try it out, maybe you'll be lucky. What you need to do is convert the .osm.pbf that you want to add to an .osc file by using osmium --derive-changes to compute the changes between an empty file and the .osm.pbf you want to add. Then use osm2pgsql --append to append the .osc file to your database.

(28 Jul '22, 10:13) Frederik Ramm ♦

Thank you, I'll try that out

(28 Jul '22, 10:35) praveen_aps
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:

×710
×263
×60

question asked: 28 Jul '22, 09:21

question was seen: 1,164 times

last updated: 30 Jul '22, 05:13

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