community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

Alteryx spatial process: "cookie cutter" style polygon slicing

Meteoroid

Hi everyone

 

I've been struggling to find a way to do the following in Alteryx:

 

Given a set of contiguous polygons (input 1), I want to be able to cut each polygon into smaller sections wherever any polygon from a second set (input 2) overlaps it. Each resulting polygon would retain the data of the polygon it originally belonged to.

 

For further clarity, here is input 1 with 15 rows, each containing a shape:

Slide1.JPG

Input 2 is brought in, containing 3 shapes . They sit on top of some of the shapes in Input 1. These 3 shapes, in turn, may or may not overlap each other.

Slide2.JPG

 

Wherever the shapes of input 2 overlap with input 1, AND wherever one shape of input 2 overlaps another shape of input 2 and then also a shape of input 1, the input 1 shape is split in as many sub-polygons as necessary:

 

Slide3.JPG

 

The output is a file similar to input 1 but now with 43 polygons as a result of the "cookie cutting" exercise (as partly illustrated above).

 

Each new polygon retains the data of its "parent". For example in the above picture, polygons 3,4,5,6,7 will all contain the same data that was originally in the polygon tagged "2" in the previous picture.

 

The "circle" (input 2) polygons contain no data and are there only for the purpose of slicing the polygons of input 1.

 

Is there a way of achieving this using Alteryx?

 

Looking forward to your suggestions!

 

: )

Alteryx Certified Partner
Alteryx Certified Partner

For sure it's possible; I think it requires an iterative macro and it's not a straight forward problem! I thought I resolved it just now but I've found a minor problem which I'll look to fix. However i'm quite busy over the next few days.

 

Let's see if anyone jumps in but in the meantime I'll keep developing a macro that allows for this.

 

Ben

Meteoroid

Impressive - I think I've been underestimating this tool!

 

Thank you and I look forward to your suggestion. I'll try the iterative macro approach myself too.

 

Sergi

@SergiArtigas Do you have any dummy data/polygons to play with?

Quasar

Are you wanting something similar to GIS Union? If so, here is a macro I created that takes two geographic inputs and overlays them to create intersecting polygons with attributes from inputs.

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Is-it-possible-to-make-alteryx-workflo...

 

Meteoroid

@Patrick_digan Yes I do indeed, sorry it took so long to reply. The attached package contains a sample of shapes (the squares in my diagram) and target areas (the circles).

 

@Philip Thank you, I came across your solution in that thread and it does achieve what I need in principle, but I didn't know how to build a workflow that will take every shape in the file and cut the other file accordingly. That is, in a way that is repeatable no matter what number of "cutting shapes" your bring in.

@SergiArtigas

 

Attached is my attempt at it. I haven't checked out @Philip's macro.

 

I used a spatial match to get all the intersections. I then summarized that into 1 object and removed this from the original spatial objects. I've added a filter in there at one point in case you want to take out really small areas. I've currently turned it off by checking if 1=1, but you could remove the comments and turn it back on. You'll notice the last record at the very end has  8.04883526561763e-007 Sq Mi, which seems like noise more than anything.

 

 

Meteoroid

Thanks very much Patrick, I didn't think this could be done in such a straightforward workflow.

 

There's just one think I've tested and doesn't quite work with your setup - if the circle shapes in the "target area" file overlap each other (workflow attached showing this, for reference).

 

My best guess is that a similar procedure needs to be applied to the "target areas" file first, until each intersection is a separate polygon, and then make that the input of the workflow.

 

An iterative macro (where only 1 circle goes through your workflow each time) could be the solution, as I think @BenMoss was suggesting. I will try this approach and share it if I succeed.

@SergiArtigas It looks like that is exactly what @Philip's macro is doing. It first finds any overlapping areas within each spatial set and then finds the intersections between the two sets. If his macro isn't a perfect fit for your situation, it would at least be a great starting point.

Meteoroid

You're right - I initially thought Philip's solution wouldn't work with just any number of shapes, but it does.

 

Thanks everyone for your help!

Labels