Add "buffer" region to polygon

1. A concise explanation of the problem you’re experiencing.

Is there a way to create a polyline and/or polygon and then create a “buffer” zone around it?

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

What I would like to do is create a polyline, for example, from 10, 10 to 10, 30, and specify a buffer around it, so that I have a polygon.

polygon = makePolygon( polyline : {

positions : Cesium.Cartesian3.fromDegreesArray([10, 10, 10, 30]),

width : 1, //width of the line

buffer: 5, //offset

material : Cesium.Color.BLUE

} )

and the resulting polygon will be 5, 5, 15, 5, 15, 35, 5, 35, at which point I could render it.

Is there something similar for Polygons as well?

4. The Cesium version you’re using, your operating system and browser.

Cesium v1.62


I would suggest you to use turfjs for this kind of requirements.

you could take the original polygon, and create the buffer one, then give it to ceisum.

I’ve been using it as well. though there are some cases that they are not totally accurate.