2

The problem i'm trying to solve is rather simple:

Given any point X lookup the country Y which it belongs to

Assumptions:

  • Country boundaries are expected to be intersection free and have a reasonably high resolution
  • All points being looked up are part of a landmass and should therefore be assignable to a country

I'm currently using the admin0 dataset provided by the NaturalEarth project to solve this but wondered if it can be simplified further to save space and computation time without losing too much precision.

My first naive approach was to apply a line simplification algorithm using https://mapshaper.org/. While this was successful to a certain degree, i noticed a negative impact on the resolution and landmass coverage:

  1. Douglas-Peucker

Douglas-Peucker

  1. Visvalingam

Visvalingam

Would it be possible to only simplify non-shared line segments like coastlines and group islands? Geofabrik seems to be doing something similar when displaying the extents of their downloads:

Geofabrik simplified shape

3
  • A better solution for saving time would be to dice the polygons with a 10-, 15-, or 30-degree fishnet. This would save two or three orders of magnitude in performance and retain figure-ground fidelity. – Vince Nov 20 '20 at 12:07
  • Notice that the polygons Geofabrik use are available for download! – Ture Pålsson Nov 20 '20 at 13:27
  • @TurePålsson but it seems they're not intersection free and a few countries are missing(e.g microstates like San Marino) – OTBuzz Nov 20 '20 at 16:13
2

You can make a query with Overpass Turbo (API for OpenStreetMap) with admin_level=2 and get the country borders, including a buffer on the shores for the territorial waters. Increase timeout, as it takes a while to get all features. You will get highly detailed land-borders, so consider to generalize - if you use QGIS, you could use Grass tool v.generalize.

enter image description here

0

Following the answer provided by babel i was able to generate a boundaries file based on admin2 boundaries downloaded from https://osm-boundaries.com using https://mapshaper.org/

enter image description here

The result is about 3.2MB big while still offering a good resolution for my usecase.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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