getCoordinate method

Coordinate getCoordinate(
  1. Geometry linearGeom
)

Gets the {@link Coordinate} along the given linear {@link Geometry} which is referenced by this location.

@param linearGeom the linear geometry referenced by this location @return the Coordinate at the location

Implementation

Coordinate getCoordinate(Geometry linearGeom) {
  LineString lineComp = linearGeom.getGeometryN(componentIndex) as LineString;
  Coordinate p0 = lineComp.getCoordinateN(segmentIndex);
  if (segmentIndex >= numSegments(lineComp)) return p0;
  Coordinate p1 = lineComp.getCoordinateN(segmentIndex + 1);
  return pointAlongSegmentByFraction(p0, p1, segmentFraction);
}