code: private static LineString linearZInterpolation(LineString lineString) {
          double startz = lineString.getStartPoint().getCoordinate().z;
          double endz = lineString.getEndPoint().getCoordinate().z;
          if (Double.isNaN(startz) || Double.isNaN(endz)) {
              return lineString;
          } else {
              double length = lineString.getLength();
              lineString.apply(new LinearZInterpolationFilter(startz, endz, length));
              return lineString;
          }
      }
docs: Interpolate a linestring according the start and the end coordinates z
  value. If the start or the end z is NaN return the input linestring
  
  @param lineString
  @return