Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
SOLVED

Combine spatial points

OmarVentocilla
5 - Atom

Hi Community, I'm trying to combine some spatial points using the summarize tool. This is my workflow:

workflow.png

 

 

 

 

 

 

 

 

 

This ran successfully and here is my output:

output.png

 

 

 

 

 

 

 

 

 

 

 

 

But my original data has one more point that isn't considerated for the combination.

firstoutput.png

 

 

 

 

 

 

 

 

 

I don't know if I'm the only one having this problem. Can somebody help me please? (Data attached)

Thanks

 

 

5 REPLIES 5
gabrielvilella
13 - Pulsar

Hi @OmarVentocilla, my guess is that you are trying to combine those points into a single one, right? In this case, you just need to add the spatial field as Create Centroid in the Summarize tool. This will create a single point which is the geographical center of all those points.

r_manju02
8 - Asteroid

Hi,

 

Looks like alteryx uses 6 decimal places for spatial index (refer below article), if that the case your 3rd and 5th item refer to same centriod when combined.

 

Reference: Spatial Match Behavior (alteryx.com)

 

r_manju02_0-1645423882826.png

 

OmarVentocilla
5 - Atom

Yes, but I'm trying to combine the points into a Multipoint object. So, this Multipoint object contains all the intial points. Like this: 

 

multipoint.png

 

 

 

 

 

But, it doens't consider the 3rd point.

OmarVentocilla
5 - Atom

Yes, but I'm trying to combine the points into a Multipoint object. So, this Multipoint object contains all the intial points. Like this: 

multipoint.png

 

 

 

 

But, it doens't consider the 3rd point.

CharlieS
17 - Castor
17 - Castor

This piqued my curiosity and I think I know what's going on. Spoiler alert: You're not going to be able to create the MultiPoint object that you want. 

 

Test 1: GeoJSON

Behind the scenes, Alteryx spatial uses GeoJSON to quantify spatial object. if you want to see what this looks like, use a Select tool and change the field type of a SptialObj field to "V_String" and the result will be the GeoJSON string for that field. For example, the string for the first record centroid is:

 

{ "type": "Point", "coordinates": [ -76.966413, -12.107038 ] }

 

I bring this up because one of the tests I did was instead of letting the Summarize tool build the string, I do this manually, then convert the string field to a SpatialObj. This didn't work so it's not something unique to the Summarize tool or how that's configured. 

 

Test 2: Subsets

We know that Alteryx can create the points individually. The problem is that this combination cannot be created, so is there a subset that can be? Turns out the answer is yes! If we use some Sample tools on the points, we can see that we can create a MultiPoint object with record 3 in is (first 3 and first 4 both work as expected). However, we cannot create a MultiPoint object with records 3 and 5 both in it. This is where the 6 decimal accuracy mentioned by @r_manju02 comes into play. So onto Test 3.

 

Test 3: 6 decimal accuracy

Why do record 3 and 5 conflict? because when you convert each of them to 6 decimal accuracy, they're the same point. Now it's time to bring up another characteristic of the MultiPoint object: each point is unique. In ever scenario of creating or decomposing the GeoJSON, we find that Alteryx will only generate the object of unique points. After all, there's no point to stack redundant points on top of each other when you've combined them into a MultiPoint object, right?

 

That's when it dawned on me: "What's the most efficient way for Alteryx to determine the unique points from a list?" Create and reference a spatial index! and since we know that spatial indices in Alteryx are accurate to 6 decimal places, and points 3 and 5 are identical through that lens, when Alteryx uniques the points, it eliminates one of the points. after that's done, it goes back to the using the original values to combine into the GeoJSON string. 

 

TLDR: Yes the points are unique, but Alteryx will always unique the points going into a MultiPoint object. It uses a spatial index to do this, which considers records 3 and 5 the same at the 6 decimal precision and will eliminate one of those records.

TLDR TLDR: @r_manju02  is right.

 

Hopefully you find this helpful. I've attached my workflow where I show some of these tests. 

 

Labels