Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Spatial Match - Intersection Only

8 - Asteroid

My Grid.yxdb table consists of 1 million spatial grids. I also have a Country.yxdb table which is a country also split into a few hundred thousand grids. I want to spatially match these two tables so that the output is the intersection polygons only, but then also the whole grids and part grids from Grid.yxdb that didn't intersect.


My issue here is that lets say 25% of say Grid_ID=123 (from Grid.yxdb) is intersected by a country grid. The other 75% lies in the sea so didn't have an intersection. I want the output to then be two records for Grid_ID=123, where one is the intersection polygon, and the other would be a polygon for the 75% that didn't intersect. So say in future if I was to spatially combine these two records, I would get my original grid for Grid_ID=123.


Obviously if I tick the box in the Spatial Match tool to output intersection polygons, I wouldn't get the sections of grids from Grid.yxdb that didn't intersect. So how would I do this? Thanks in advance.

ACE Emeritus
ACE Emeritus

Some sample data would work a charm here!



8 - Asteroid

Unfortunately, I am not able to share a sample of the data due to restrictions. What I can do is provide you with a couple of screenshots of what I am trying to replicate that was built years ago but I am not sure how it was done.





You can see from the screen shots that the original grid with ID 7347 has been split into 3 polygons. Two of those are intersections as they have LS_ID data appended which is the grids from the other table. The third record is the remainder of the original polygon that didn't match, hence it has an LS_ID value of 0 (which appeared as NULL in alteryx). 


Using the Spatial Match tool and ticking intersections only would give me the first two records, but how do I also include the remainder of the grid that didn't match? For grids that had no intersections at all, the whole grid would be included as a record.



11 - Bolide

Hi @al_sweets,


If I understood well, you want to keep the big full grid that match and having it divided in two parts. 

The part that intersect and the part that does not intersect.

what I do, after the Spatial match, I group the big grid in order to combine the small polygon into one.

Now, in the same row, I have two polygon, one that is the full grid, the other one is just the intersection.

After that I use the Spatial Process tool and I cut out from the full grid the intersection. Now I have the part of the grid that does not intersect.

Then I just select the two desired grid and use a transpose to put all the polygon in rows.


I hope this is what you are looking for?

12 - Quasar

It sounds like a GIS UNION process?



Here is a macro that will do it.


8 - Asteroid

Hi Philip,


I knew this was possible and easy in GIS software, but my files were too large. The macro you have provided is a great workaround, many thanks!