public IEnumerable <double> GetIntersectionOfLine(ILineString primaryLine, ILineString subline) { var lil = new LengthIndexedLine(primaryLine); var result = lil.IndicesOf(subline); return(result); }
private void Stuff(MultiLineString multilinestring, IEnumerable <MultiLineString> troutStreamSections, MultiPolygon pal) { IGeometry[] t = multilinestring.Geometries; var stream = t.First(); var primaryLength = stream.Length; var lil = new LocationIndexedLine(stream); var lil2 = new LengthIndexedLine(stream); var result = stream.Intersection(pal) as MultiLineString; var geoms = result.Geometries; foreach (var part in geoms.Select(i => i as LineString)) { var subParts = lil.IndicesOf(part); var count = subParts.Length; foreach (var subPart in subParts) { var fraction = subPart.SegmentFraction; var noIdea = subPart.GetSegmentLength(part); var otherNoIdea = subPart.GetSegmentLength(stream); } var subParts2 = lil2.IndicesOf(part); var count2 = subParts2.Length; foreach (double subPart in subParts2) { // var fraction = subPart. // var noIdea = subPart.GetSegmentLength(part); // var otherNoIdea = subPart.GetSegmentLength(stream); } } }
protected override Geometry IndicesOfThenExtract(Geometry linearGeom, Geometry subLine) { var indexedLine = new LengthIndexedLine(linearGeom); double[] loc = indexedLine.IndicesOf(subLine); var result = indexedLine.ExtractLine(loc[0], loc[1]); return(result); }
/// <summary> /// /// </summary> /// <param name="wkt"></param> /// <param name="start"></param> /// <param name="end"></param> public void RunExtractedLine(string wkt, double start, double end) { Console.WriteLine("========================="); IGeometry g1 = rdr.Read(wkt); Console.WriteLine("Input Geometry: " + g1); Console.WriteLine("Indices to extract: " + start + " " + end); LengthIndexedLine indexedLine = new LengthIndexedLine(g1); IGeometry subLine = indexedLine.ExtractLine(start, end); Console.WriteLine("Extracted Line: " + subLine); double[] index = indexedLine.IndicesOf(subLine); Console.WriteLine("Indices of extracted line: " + index[0] + " " + index[1]); Coordinate midpt = indexedLine.ExtractPoint((index[0] + index[1]) / 2); Console.WriteLine("Midpoint of extracted line: " + midpt); }