Inspire EMEA 2022 On-Demand is live! Watch now, and be sure to save the date for Inspire 2023 in Las Vegas next May.

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

Comparing spatial objects for equality

Ned
Alteryx Alumni (Retired)
Created

Compariing spatial objects for equality is very subtle, because you have to define what is meant by equal.  In the case of polygons, you can have 2 different polygons that describe the same shape, but have a different start and end point.  Most people would say these are the same, but if you compare them exactly, they are in fact different.  For instance:

 

[ -104, 39], [ -105, 39 ], [ -104, 38 ], [ -104, 39 ]

[ -105, 39 ], [ -104, 38 ], [ -104, 39], [ -105, 39 ]

 

These 2 sets of points describe the same shape just from different starting points.  The same problem exists with lines - the same line specified backwards and forwards looks the same on a map, but would not be superficially equals.

 

The easiest way to test for equality is to test: does object A contain object B and also, does object B contain object A.  If they both contain each other, they must cover the exact same area on a map.

 

In a formula or filter tool, you can say:  ST_Contains([A],[B]) AND ST_Contains([B],[A)

 

In a SpatialMatch tool, you have to use a custom DE-9IM string to describe the match you want.  In this case, use the string "T*F**FFF*".  I won't try to document that string - see https://en.wikipedia.org/wiki/DE-9IM for a reference of how that works.

 

Attached is a module (for Alteryx 10) that demonstrates both techniques:

SpatialEquals.png

Attachments
No ratings