Requirements – Spatial data
It’s worth using a select tool to make sure that all the data being inputted is of the spatial object datatype. There are some scenarios where not having the right data types won’t force an error but instead will output the data as having no matches.
![](https://www.thedataschool.co.uk/content/images/2022/05/spatial.png)
Here we can see that SpatialObj is a spatial object but, SpatialObj_Built is a string. Alteryx won’t force an error but as we can see, there are 0 matches. To fix this we would have to use a select tool before this and convert SpatialObj_Built back to the appropriate datatype.
Target and Universe
Similarly to a normal join, where the order of connections (L or R) matters, it’s worth understanding the difference between target and universe. Essentially, the universe is what we’d normally consider the target (bit weird I know). A nice way to think about it is like this…
Imagine that the universe is a dartboard and the targets are a series of darts. Every time a dart hits the dartboard there is a matched entry and every time the dart misses there is an unmatched entry. To show the difference between the two let’s take two sets of data and input them into spatial match both ways and compare the difference.
![](https://www.thedataschool.co.uk/content/images/2022/05/image-30.png)
In this dataset the target is different flight paths and the universe is that state of Utah. In this case every time a flight path crosses Utah there is a match and every time the flight path doesn’t cross Utah there isn’t. When we do this the other way round, we find something different happens.
![](https://www.thedataschool.co.uk/content/images/2022/05/image-31.png)
This time the universe is all the flight paths and the target is Utah. When Utah matches the flight path a match is created. However since the universe is the combination of every flight, Utah exists within the universe, and therefore spatial match cannot identify mismatches as mismatches and simply removes them. Going back to the dartboard example it’s the equivalent of not throwing a dart and therefore said darts cannot register as a miss.
It's a bit complicated but that should add some insight into how the target and universe anchors work. A simple tip to getting around this if you’re still unsure is to try it one way, and if it doesn’t work as intended then try the other way. As the saying goes – “If at first you don’t succeed, try, try and hope for the best.”