public static FeatureCollection pointsWithinPolygon(FeatureCollection points,
                                                      FeatureCollection polygons) {
    ArrayList<Feature> features = new ArrayList<>();
    for (int i = 0; i < polygons.features().size(); i++) {
      for (int j = 0; j < points.features().size(); j++) {
        Point point = (Point) points.features().get(j).geometry();
        boolean isInside
          = TurfJoins.inside(point, (Polygon) polygons.features().get(i).geometry());
        if (isInside) {
          features.add(Feature.fromGeometry(point));
        }
      }
    }
    return FeatureCollection.fromFeatures(features);
  }
public static FeatureCollection pointsWithinPolygon ( FeatureCollection points , FeatureCollection polygons ) { ArrayList < Feature > features = new ArrayList < > ( ) ; for ( int i = 0 ; i < polygons . features ( ) . size ( ) ; i ++ ) { for ( int j = 0 ; j < points . features ( ) . size ( ) ; j ++ ) { Point point = ( Point ) points . features ( ) . get ( j ) . geometry ( ) ; boolean isInside = TurfJoins . inside ( point , ( Polygon ) polygons . features ( ) . get ( i ) . geometry ( ) ) ; if ( isInside ) { features . add ( Feature . fromGeometry ( point ) ) ; } } } return FeatureCollection . fromFeatures ( features ) ; }
Takes a {@link FeatureCollection} of {@link Point} and a {@link FeatureCollection} of
{@link Polygon} and returns the points that fall within the polygons.

@param points   input points.
@param polygons input polygons.
@return points that land within at least one polygon.
@since 1.3.0