0

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).

Corey Alix
  • 2,694
  • 2
  • 27
  • 38

2 Answers2

1

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)

tval
  • 412
  • 3
  • 17
  • I see -- or I could buffer the line itself and then look for the closest point from a point on the centerline to the buffered geometry. It seems computationally heavy-handed but it should work. – Corey Alix Nov 17 '18 at 11:58
1

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)

FObermaier
  • 832
  • 5
  • 12
  • `public Coordinate extractPoint(LinearLocation index, double offsetDistance)` `index` - the index of the desired point `offsetDistance` - the distance the point is offset from the segment (positive is to the left, negative is to the right) – Corey Alix Dec 08 '18 at 23:05