Hi, I'm trying to build a dataset with only countries boundaries out of a selected number of countries, I need all administrative levels, I have been able to find useful answers and wiki pages that have proved to be useful to create a pipeline with osmfilter and osm2pgsql. My pipeline (any suggestion is welcome if something I'm saying is wrong) is set to filter out unwanted informations from osm files with osmfilter and then importing the files in PostgreSQL with osm2pgsql, then, I can view data with QGIS by importing layers from planet_osm_polygon tables.

I got issues with country borders, for example Canada and Mexico: It is my understanding that Canada and Mexico are presents in geofabrik extracts of North America (north-america-latest.osm.pbf), Canada also has it's own file canada-latest.osm.pbf that should be a subset of North America. I filter with: osmfilter in.o5m --keep-relations="boundary=administrative" --keep-nodes= --keep-ways= -o=out.osm Then add data to database: osm2pgsql -s -C 1500 -d dbdest -U osm_importer out.osm

Examining the data with QGIS seems that North America with an admin_level level 2 filter shows Canada border along with US but not Mexico that should be there too; Canada only data, instead, at level 2 shows nothing but Graham and Moresby Island (Pacific) and St-Pierre and Sabre Island (Atlantic)

I hope I don't need to do a full OSM / planet import to address this issue.

Thanks

asked 25 Jul '17, 22:30

nicolape's gravatar image

nicolape
16113
accept rate: 0%


Why don't you simply use https://wambachers-osm.website/boundaries/ which was just a google away? (yes I'm aware that this is not really an answer to the question)

permanent link

answered 25 Jul '17, 23:10

SimonPoole's gravatar image

SimonPoole ♦
37.9k13284602
accept rate: 19%

edited 25 Jul '17, 23:20

1

Thank you for your answer, I have stumbled upon that website in my journey to the boundaries :) , I'm willing to considered your solution as a fallback in case I'll be not able to "manually" filter data by myself.

(26 Jul '17, 09:31) nicolape
1

In any case I can see just a bit too much that could go wrong in your processing workflow, why not simply change the "default.style" so that you only import boundaries and avoid the osmfilter step?

(26 Jul '17, 10:13) SimonPoole ♦

Thank you again, I have changed the pipeline, now I use osm2pgsql on the country pbf file from geofabrik, I use a style file with: node,way admin_level text linear node,way boundary text linear node,way name text linear

Unfortunately I'm still getting partial/incomplete boundaries, for example Mexico at level 2 is missing completely the land border, it has only islands, in level 4 is missing Sonora (1673426) in land, still getting his islands. I was thinking it could be related to the US border, since in the extract is supposed to be only Mexico, but unfortunately others mexican states next to US border as Cihuahua (1673425) are correctly displayed.

(27 Jul '17, 11:27) nicolape

You are not by any chance importing the extracts one by one? If yes I'm surprised that it works at all. You should be pre-merging the extracts before import.

(27 Jul '17, 13:36) SimonPoole ♦
1

Since you showed me the flaws in my process I moved to wambacher as you suggested in the first place, thanks to the help of Walter, he's very kind and patient, I was able to generate the boundaries for my countries.

(31 Jul '17, 10:52) nicolape
1

Do you mind explaining the problems you ran into? Ideally right here in a separate answer so that other people can profit from your experience.

(31 Jul '17, 12:10) scai ♦
showing 5 of 6 show 1 more comments
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:

×196
×100
×38
×17
×8

question asked: 25 Jul '17, 22:30

question was seen: 1,439 times

last updated: 31 Jul '17, 12:10

powered by OSQA