0

I'm working on a project which requires me to build a function to expand a polygon of long/lat in a distance of X miles to create a "border".

Example of border around a polygon to X number of miles

The technology i am using is JavaScript deskgl / nebula gl layers. And i am unsure whether javascript deskgl/nebula gl has the built in ability to perform these operations. If not, this leads me to question the maths behind this functionality.

As i am unfamiliar with long an lat on a 2d plane, nor whether the stack i am using can deal with this, how do i go about expanding an array of arrays (long, lat) by X number of miles.

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
Craig
  • 35
  • 3
  • Are the polygons necessarily convex? Otherwise the algorithm is pretty complicated. – Ovinus Real Aug 21 '20 at 08:19
  • 1
    If the polygons can be any (simple) polygon check out the answers here: https://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygons. There are some answers for JS included. – Ovinus Real Aug 21 '20 at 08:20

1 Answers1

0

You should look into the ScaleMode in Nebula, it allows you to click and then drag a polygon and keeps it's shape. If you need to be able to do that by a specific distance, you could look into their implementation of scaling and you could adapt that.

patwards
  • 97
  • 1
  • 5