intersects(...)Allows you to compare two geospatial types to see if they intersect or overlap each other
Works with the following datatypes:
This function works with 2.1 and 3.0 endpoint(s). What does this mean? »
The intersects(...) function is most commonly used in the $where parameter or WHERE clause as a filter for Point
, Line
, and Polygon
fields, to identify records that intersect or overlap with another. It accepts two parameters:
A Point
, Line
, or Polygon
in WKT (Well-Known Text) format
WKT is a standard way of encoding geospatial data in a textual manner, and is more compact than GeoJSON. For example, a Point would be encoded as:
POINT (-87.6174045 41.8669236)
Heads up! Contrary to the normal convention of "latitude, longitude" ordering in the coordinates property, Well-known text orders the coordinates as "longitude, latitude" (X coordinate, Y coordinate), as other GIS coordinate systems are encoded.
The intersects(...) method is frequently used to identify what Polygon a given point is within. For example, the below query will identify what park a given point is within:
The TryIt macro has been disabled until future notice while we upgrade this site to SODA3.
It’s also useful for intersecting polygons with other polygons. For example, the following will return all of the parks that intersect with an arbitrary triangle in Chicago:
The TryIt macro has been disabled until future notice while we upgrade this site to SODA3.