Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
4. How ST_Equals works
Relationships Between Geometries
ST_Distance and ST_Dwithin
Spatial joins practice


Nicely done! As we've already mentioned, ST_Equals checks whether two geometries represent the same location or space. ST_Equals ignores the order of vertices in a polygon, the starting point of a polygon, and even additional vertices that do not change its shape. Look at the image below:


ST_Equals will consider Figure 1, Figure 2, Figure 3, and Figure 4 to be equal, even though their representations are certainly different. Take a look at the following query:

FROM sf_hotels sh
JOIN sf_sights ss
ON ST_Equals(sh.boundaries, 

As you can see, we passed in the ST_Reverse function as one of the arguments to ST_Equals. The ST_Reverse function returns a geometry with the vertex order reversed. So, if we had the linestring ABC, the ST_Reverse function would return the linestring CBA.

In accordance with our earlier explanation, even though we reversed the vertex order of one of its arguments, the ST_Equals function still returned TRUE and gave us the same result.


Click the Run and Check Code button and note that both ST_Equals usages return the same result.