Skip to content

BufferCS

sindizzy edited this page Dec 30, 2020 · 4 revisions

Sample code that demonstrates how to buffer a randomly generated point.

using DotSpatial.Geometries;
using DotSpatial.Topology.Geometries;

private void button1_Click(object sender, EventArgs e)
{
    Coordinate coords = new Coordinate();
    Random rnd = new Random();
    coords = new Coordinate((rnd.NextDouble() * 360) - 180, (rnd.NextDouble() * 180) - 90);
    DotSpatial.Topology.Point p = new DotSpatial.Topology.Point(coords);
    //This will get the area of the buffer.
    double area = p.Buffer(500).Area;
}
Clone this wiki locally