Spatial Filter can be used to create a result dataset that contains a copy of the features on a map that meet a series of criteria based on a spatial query.
Example
A city's police department is conducting an analysis to determine if there is a relationship between violent crimes and unemployment rates. An expanded summer job program will be implemented for high schools in areas where there is high violent crime and high unemployment. Spatial Filter can be used to create a dataset of high schools within the remediation areas.
Run Spatial Filter
Spatial Filter can be run on maps with two layers (points, lines, or areas).
Complete the following steps to perform a spatial filter:
- Click the map card to activate it if necessary.
A card is active when the toolbar and Action button appear.
- Click the Action button, and choose Spatial Filter.
- For Choose layer to filter, select the layer to filter.
- For Choose layer to filter by, select the layer to use to filter the first layer.
- For Choose type of filter, select the spatial relationship to use for the filter.
See the Usage notes section below for more information.
- Click Run.
Tip:
You can also run Spatial Filter by dragging a dataset onto the Filter by selected feature drop zone on an existing map.
Usage notes
The Choose layer to filter parameter is the input point, line, or area layer that you want to filter. The result dataset will be a subset of this layer.
The Choose layer to filter by parameter is the input point, line, or area layer that will be used to filter the first layer.
Tip:
You can use selected features in Spatial Filter. For example, if you have a dataset of store locations across the United States but you only want to analyze stores in California, you can select California in the US States layer, drag the selected feature to the map of store locations, and drop the selected feature on the Filter by selected feature drop zone.
The Choose type of filter parameter is used to specify the relationship between the two input datasets. The following filter types are available in Insights:
Filter type | Description |
---|---|
Intersects | If a feature in the first layer intersects a feature in the second layer, the feature in the first layer is included in the output. |
Doesn't Intersect | If a feature in the first layer intersects a feature in the second layer, the feature in the first layer is excluded from the output. |
Contains | If a feature in the first layer contains a feature in the second layer, the feature in the first layer is included in the output. |
Doesn't Contain | If a feature in the first layer contains a feature in the second layer, the feature in the first layer is excluded from the output. |
Limitations
When you perform spatial aggregation or spatial filtering on data from the same database connection, you must ensure that all the data is stored in the same spatial reference system. For datasets from Microsoft SQL Server, the data must also have the same data type (geography or geometry).
SAP HANA does not support ST_Contains for geographic (round-earth) coordinate systems. Spatial filtering using the Contains and Doesn't Contain filter types will fail for SAP HANA datasets with a geographic coordinate system.