I successfully downloaded the OSM data from https://www.geofabrik.de/ and converted the .osm.pbf file to a .gpkg using og2ogr. Now I want to extract administrative boundaries using DB-Manager and SQL:

FROM multipolygons
WHERE admin_level = 4

However, I need the physical borders, which do not fall in a line with the administrative borders in coastal areas (see picture). Having a look at OSM, for example via QGIS, the information is there, but I can not figure out which key to use and how to extract them.

enter image description here

What would be the correct way?

  • 2
    Please provide example data for the seaside area, and for the land area.
    – Erik
    Apr 23, 2021 at 9:46
  • 1
    Well, that's the problem. I downloaded the russia-latest.osm.pbf from download.geofabrik.de/russia.html and I want to extract the land area separated by the admin borders. If I know the key for the land area I would clip it by myself. But I can not find a way to extract only the land area. Does this make sense?
    – parallax
    Apr 23, 2021 at 9:52
  • 2
    Use the shorelines to clip the administrative polygons.
    – Babel
    May 7, 2021 at 10:38

1 Answer 1


I think you are wrong with the admin_level which should be admin_level=2 instead of admin_level=4, check the OSM's Wiki.

  • Thank you. I've already spent a lot of time looking for the right query and I know this page. Though, for Russia 'admin_level' starts at 3. However, I need the land area - the physical border of the land area (white polygons of the countries).
    – parallax
    Apr 27, 2021 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.