In my blog on data types I barely talked about spatial data for a sentence or two. As possibly Alteryx’s most powerful feature, spatial data and it’s uses needed much more attention than I could afford in that post so here’s an entire one dedicated to it.
Spatial Data Categories
At their core, all spatial data types are sets of points with different properties attached. Points are as you’d guess, sets of one, they are the building blocks of spatial data. They are self contained geolocational points with associated longitudinal and latitudinal information. Lines are sets of points connected in sequence and grouped together as single objects. Lines are useful in calculating route distances between A and B through points C, D and E. Polygons are sets of points connected in sequence but then Alteryx links the first point to the last to complete a loop. The polygon is then the area contained within this loop. These are especially useful when working with catchment or sales areas. Alteryx can then make lots of quick spatial calculations based on polygons containing points or overlapping other polygons.
Creating Spatial Data
As mentioned earlier, Points are the building blocks of spatial data. If you want to build anything else you have to start with points. You can create a point using one of two tools.
Map Input allows you to point and click on a map in Alteryx and create points manually and is best used when transcribing data points you cannot access in tabular form.
Create Points requires you to have longitudinal and latitudinal x and y co-ordinates in tabular form. Create Points can then instantaneously create a field of spatial points and populate a map with them via the Browse tool.
To create complex shapes there are a couple of different methods too. Firstly, again, there is Map Input where you can also create lines and polygons through their indicators in the input’s toolbar. Then there’s this:
Poly-Build is a catch-all tool for turning points into other spatial data. You can build Sequence Polylines through points given in sequential order, Sequence Polygons around points in a given order and Convex Hulls which contain all the points in a set without any concavities in the shape’s outline. Poly-Build has configuration settings so that you can create multiple shapes from a single field of points. There is a grouping option for grouping points by certain criteria before combining them and there is an option to select a sequencing field where you can dictate the order in which a line or polygon is drawn.
Once we have this spatial data there are so many things we can do with them in Alteryx. Here are a couple of the most useful:
Distance does exactly what it says on the tin and measures distances between two points or a point and a complex shape. One thing to be aware of with Distance is you must have your two points as separate fields across a record. You cannot measure distances between records within a field without cross-tabulation.
Find Nearest allows you to find the nearest N points to a target. If you want to find the furthest points you can use the unmatched data points that aren’t within the nearest N.
Spatial Match is my favourite spatial tool because its relational calculations are so powerful. If you have two polygons it can create intersecting polygons, tell you if one polygon contains the other, or tell you whether their boundaries touch. If you are working with a polygon and a set of points it can match the points that fall within the polygon or you can take the unmatched points which represent the set of points outside of the polygon.
This has just been the tip of the iceberg with spatial relationships and I encourage you to check out the other spatial tools at the Alteryx help page for more inspiration.