# filters.crop

The crop filter removes points that fall outside or inside a cropping bounding box (2D or 3D), polygon, or point+distance. If more than one bounding region is specified, the filter will pass all input points through each bounding region, creating an output point set for each input crop region.

Default Embedded Stage

This stage is enabled by default

Streamable Stage

This stage supports streaming operations

The provided bounding regions are assumed to have the same spatial reference as the points unless the option a_srs provides an explicit spatial reference for bounding regions. If the point input consists of multiple point views with differing spatial references, one is chosen at random and assumed to be the spatial reference of the input bounding region. In this case a warning will be logged.

## Example 1

This example crops an input point cloud using a square polygon.

    [
        "file-input.las",
        {
            "type":"filters.crop",
            "bounds":"([0,1000000],[0,1000000])"
        },
        {
            "type":"writers.las",
            "filename":"file-cropped.las"
        }
    ]

## Example 2

This example crops all points more than 500 units in any direction from a point.

    [
        "file-input.las",
        {
            "type":"filters.crop",
            "point":"POINT(0 0 0)",
            "distance": 500
        },
        {
            "type":"writers.las",
            "filename":"file-cropped.las"
        }
    ]

## Options

bounds

  The extent of the clipping rectangle in the format `"([xmin, xmax], [ymin, ymax])"`. This option can be specified more than once by placing values in an array.

  Note

  3D bounds can be given in the form `([xmin, xmax], [ymin, ymax], [zmin, zmax])`.

  Warning

  If a 3D bounds is given to the filter, a 3D crop will be attempted, even if the Z values are invalid or inconsistent with the data.

polygon

  The clipping polygon, expressed in a well-known text string, eg: `"POLYGON((0 0, 5000 10000, 10000 0, 0 0))"`. This option can be specified more than once by placing values in an array.

outside

  Invert the cropping logic and only take points outside the cropping bounds or polygon. [Default: false]

point

  An array of WKT or GeoJSON 2D or 3D points (eg: `"POINT(0 0 0)"`). Requires distance.

distance

  Distance (radius) in units of common X, Y, and Z Dimensions in combination with point. Passing a 2D point will crop using a circle. Passing a 3D point will crop using a sphere.

a_srs

  Indicates the spatial reference of the bounding regions. If not provided, it is assumed that the spatial reference of the bounding region matches that of the points.

where

  An expression that limits points passed to a filter. Points that don’t pass the expression skip the stage but are available to subsequent stages in a pipeline. [Default: no filtering]

where_merge

  A strategy for merging points skipped by a ‘where’ option when running in standard mode. If `true`, the skipped points are added to the first point view returned by the skipped filter. If `false`, skipped points are placed in their own point view. If `auto`, skipped points are merged into the returned point view provided that only one point view is returned and it has the same point count as it did when the filter was run. [Default: `auto`]

## Notes

1. See Clipping data with polygons: and Clipping with Geometries for example usage scenarios for filters.crop.