This project has moved. For the latest updates, please go here.

Implementing the LineString.Value method. How?

Oct 9, 2006 at 5:50 PM
Hello everybody!

I wanted to use the LineString.Value method, to get a specific point on the line, but i found that the Value method for this is unimplemented.

How is it possible to get a point on the line by percent?

Like this:

SharpMap.Geometries.Point p = line.Value(line.Length * 0.33);

Or something like this. Is it possible? In this case there would be a point on the line at, 0.33 from the 1.


Oct 10, 2006 at 1:35 AM
You can get an interpolated point using NetTopologySuite:
Point point = new Point(new LengthIndexedLine(line).ExtractPoint(0.33 * line.Length));

The linestring should be converted to NTS model and the point back to SharpMap using ToNTSGeometry and ToSharpMapGeometry functions as defined by the NetTopologySuite Data Provider.

Best regards,
Ricardo Stuven.
Oct 10, 2006 at 5:02 PM
Thanks for the help!