Alright! As you hopefully noticed, these four functions we just covered are all very similar, but they each display unique behavior. All of them allow you to examine relations between various geometries in greater detail.
Sometimes, though, you don't really want to be so meticulous, or your geometry structures are not very precise and you can't be sure whether two geometries touch or overlap each other. What to do, then?
There is another function called
ST_Intersects(geometryA, geometryB), which is a generalized version of the three we got to know before. It checks if two geometries have any space in common. If they do, it returns
TRUE. In other words, if the geometries overlap OR touch each other OR one of them is within the other,
Take a look at the following query:
FROM sf_planning_districts spd
JOIN sf_bicycle_routes sbr
WHERE spd.name = 'Northeast'
This query will return the number of bicycle routes that are completely or partially inside the Northeast district.