Spatial Operators
Understand the details of spatial operators in MySQL.
In the context of our e-scooter startup, we’ve accumulated various types of spatial data. This includes simple location points indicating where our e-scooters are stationed and more complex polygons defining the parking zones for these scooters. These data elements are essential in managing our daily operations and form the foundation for more advanced spatial analyses.
MySQL offers a set of specialized tools known as spatial operators. These operators empower us to perform calculations and derive additional spatial insights from the data gathered through our business operations.
The ST_Intersection()
function
One important type of spatial entity in our dataset is the POLYGON
. We use this geometric entity to define parking zones for our customers. To analyze these polygons, we use a function called ST_Intersection()
. It calculates the intersection between two POLYGON
or other geometries, such as points or lines. Passing two geometries as arguments, ST_Intersection()
returns a new geometry of the same type (or a container of that type) within the same spatial reference system (SRS) that denotes the intersection between the two given geometries, if any. For example, let us consider the following two polygons:
Get hands-on with 1400+ tech skills courses.