Can't Find Canada Country Polygon

Hi,

I’m currently trying to pull out Canada’s polygon data and separate it by admin levels and when I was using https://download.geofabrik.de/north-america/canada-latest.osm.pbf. I’m unable to find Canada’s Country polygon (osm id of 1428125) in that file. I’m able to find it for greenland and mexico (all at admin level 2). I was wondering if it’s just missing from the current dataset or if I’m missing something.

Thanks!

1 Like

For start note that it is only one of processed OSM extracts. See Downloading data - OpenStreetMap Wiki for other possible solutions that may or may not be better for you.

I’ve checked a few of the other extracts and it’s the same with them.

Were you checking specifically regional Geofabrik extracts?

Yes, specifically the Canada region.

It seems to be there when I look:

wget https://download.geofabrik.de/north-america/canada-latest.osm.pbf
osmium getid -r canada-latest.osm.pbf r1428125 -o c1.osm

I then loaded “c1.osm” into josm. Apart from 5 role verification issues, it seems OK.

Edit: For completeness the role verification issues were missing “role-outer” or “role=inner”. There was also “incomplete coastline” (entirely expected since Canada is not exactly one island).

That’s weird. I’m using two different ways to try and look at them one is I’m using ogr2ogr to convert it to a sqlite database and then load that in qgis.

ogr2ogr -f SQLite -dsco SPATIALITE=yes canada.sqlite canada-latest.osm.pbf 

Then the other way is I’m using python with osmium and pandas to separate them based on admin levels and converting the dataframes over to shapefiles to load into qgis.

Then likely OSM data and/or your process has some problem.

fixing this problems, if these are actual problems, may help

The thing is I’m getting the country polygons for Greenland and Mexico. Along with trying different data sources for Canada and not getting anything. When I tried using just osmium using what Andy said I saw a part of the polygon, but it has a large hole in it.