[PROJ] Geodesic buffers/offsets?

Charles Karney charles at karney.com
Wed May 5 09:20:47 PDT 2021


I can add a couple of points to this discussion...

(1) When generating points along the boundary of the buffer, it's useful
to have a test for self-intersection of the boundary.  This happens with
zero buffer width at concave corners.  However it will also happen for
curved (or even straight) portions of boundary the original area.
Equation 34 of

  https://doi.org/10.1007/s00190-012-0578-z

gives the curvature of the parallel to a curve and reentrancy happens
when the curvature becomes infinite.

(2) Instead of generating a buffer boundary, you could instead just
implement a test "is a given point within a distance x of (or inside)
the boundary?"  Suppose you divide all the edges up into segments with
lengths of d or less, so that the original area is approximated by a
geodesic polygon with edges <= d.  Then, set up a nearest neighbor
problem with the vertices of the polygon, e.g., with
GeographicLib::NearestNeighbor.

Invoke this on the query point, with maxdist = x and exhaustive = false.
If this returns a result, then the point is in the buffer; otherwise...

Invoke NearestNeighbor again to find all vertices within x + d/2 of the
query point.  If there are no such vertices, the point is outside,
otherwise check the corresponding edges to see is there's a point within
the edge which is within x of the query point.

This could probably be turned into a reasonably efficient algorithm.
Presumably for x >> d, the criterion, maxdist = x + d/2, in the second
nearest neighbor lookup can be tightened to something like maxdist =
hypot(x, d/2).  (And perhaps a fast function implementing the query is
more useful that the depiction of the buffer boundaries?)

  --Charles

-----Original Message-----
From: PROJ <proj-bounces at lists.osgeo.org> on behalf of Nyall Dawson <nyall.dawson at gmail.com>
Date: Tuesday, May 4, 2021 at 6:23 PM
To: PROJ <proj at lists.osgeo.org>
Subject: [PROJ] Geodesic buffers/offsets?

    Hi list,

    Something which I get asked on a recurring basis by users is how to
    create geometry buffers using a real-world distance on a geographic
    dataset. E.g. creating a 100km buffer on a linestring in such a way
    that the geodesic distances between the buffer and original line are
    always 100km.

    The approaches/advice I've found so far fall into these broad categories:
    - find a local projection which covers the area of interest and create
    planimetric buffers/offsets in that projection
    - for point datasets, create a custom projection centered over each
    individual point and densify/transform the planimetric buffer in that
    projection back to the geographic CRS
    - use a geographic focused library like s2 (but that has the
    limitation in that it's spherical approximations only, not
    ellipsoidal)

    Consequently, I haven't found any generic approaches for calculating
    ellipsoid based buffers/offsets, and I'm interested in other's
    thoughts on this.

    Buffers/offsets are a bit of a funny beast, because they're complex to
    calculate with a lot of corner cases to handle. So we have great
    libraries like GEOS which handle this problem well, but I personally
    can't see GEOS ever gaining support for geodesic buffers as GEOS is
    focused on cartesian calculations only. But on the other hand having
    all the logic for buffer calculation sitting in proj also seems
    completely out of scope and inappropriate too! (Maybe geographiclib
    would be the best place for something of this nature?)

    Has anyone else looked into this previously? Anyone with any insights
    on this problem?

    Cheers,
    Nyall
    _______________________________________________
    PROJ mailing list
    PROJ at lists.osgeo.org
    https://lists.osgeo.org/mailman/listinfo/proj


More information about the PROJ mailing list