Computing an event offset using NetTopologySuite?

809 Views Asked by At

Does NetTopologySuite have the tools necessary to compute a point a given distance along and away from a polyline offset in a perpendicular direction?

This would be for placing signs on a map that are described as 3.1 miles along route 242, 50 feet from the centerline. I've discovered NetTopologySuite.Geometries.Triangle.PerpendicularBisector, but it's not making much sense to me (seems to return a formula for the perpendicular line).

2

There are 2 best solutions below

1
On BEST ANSWER

To get a single point offset off a lineal geometry you should use LocationIndexedLine:

var gf = new NetTopologySuite.Geometries.GeometryFactory();
var l = gf.CreateLineString(new GeoAPI.Geometries.Coordinate[]
{
    new GeoAPI.Geometries.Coordinate(10, 10),
    new GeoAPI.Geometries.Coordinate(1000, 10),
});

var lid = new NetTopologySuite.LinearReferencing.LocationIndexedLine(l);
var p = lid.ExtractPoint(500, 10);

p is at (510, 20)

1
On

Yes, probably several ways. One way you could do it is to use a buffer from the center line (look into NetTopologySuite.Operation.Buffer.BufferOp.Buffer), then just find a point 'x' distance along the buffered geometry (NetTopologySuite.Operation.Distance.DistanceOp.Distance)