I've been using Mapshaper to simplify some very complex polygons (boundaries of countries). The goal is to create relatively simple polygons which can be used to determine whether a given lat/lon point is inside a given country. It's OK if I (somewhat rarely) wind up with a false positive, but it's not OK to ever wind up with a false negative.
Using the standard Mapshaper simplification tools, I wind up with a polygon that isn't always covering 100% of the territory covered by the original polygon. That's a problem. Is there any tool/technique that exists to create a simplified polygon that will fully enclose all the territory the original polygon covered?
Update:
To clarify: While I'll be processing one country at a time, I will be querying against a collection of countries to find which of them contains a given point. My intention is that the processed polygons will sometimes overlap, such that points right by the border between two countries will often fall in both of those countries according to the polygons. This is OK, and expected.
Best Answer
To avoid the issue of "the convex hull of China contains almost all of Mongolia", you could make use of a concave hull.
For example, here's the difference between
ST_ConcaveHull
andST_ConvexHull
in PostGIS (taken from here):In PostGIS,
ST_ConcaveHull
takes atarget_percent
parameter, which effectively adjusts how far into the cavities it will go (a lower value will result in a smaller overall area, but takes more time). The resource at 1 suggests using0.99
as a starting point for most situations.