Discussion thread for day 9 of the Advent of Code - https://adventofcode.com/2025/day/9
Alteryx spatial analysis really do great job!
(ABS([X]-[Source_X])+1)*(ABS([Y]-[Source_Y])+1)​
Here is how it looks like with my dataset.Next, create all rectangular patterns as spatial polygon object as well, and find rectangular that are contained within overall polygon by the Spatial Match tool.Once you get the target rectangular, then you just have to find the one with max area.
@gawa, great explanation! This was a fun problem except for a misunderstanding that cost me a lot of time...
Spatial tool is good.
So it turns out (as we all know) where you place parentheses in an equation matters... strangely enough mistyping my area equation in part 1 didn't throw off my solution... it just became the bane of my existence in part 2 as I spent an hour plus looking in the wrong places to fix the problem.
Realized I need to spend more time with spatial tools
My brain hurts. @Hub119 Thank you for the tip about the Spatial Match tool.
It's been ages since I've had a good reason to use spatial tools, I really enjoyed this one!
I love a chance to use the Spatial Tools
wastes 3hrs for spatial tools. turn out I got chance to find the answer if I not confuse cut1_from2 and cut2_from1.
I spent two hours debugging issue.
Pretty nice challenge today considering we're on Day 9! That is... (spoiler)
Part of the problem was difficult to understand, but it seems I took a long detour because I didn't read the problem carefully.
My 1st workflow.
Macro
After reading community.
Was determined to avoid using the Spacial tools, went down a complete rabbithole by building out a grid using formulas, realised the maths would never allow that to work, gave up and force myself to use Spacial.Really wish I had, as it took a fraction of the time. And isn't that what AoC is supposed to be about, using things you don't typically use.
Day 9
Went around in circles trying to get a math and macros solution before recalling that this was a spatial tool first.
The math solution produced some delightful outputs for the test data and then overflowed the temp directory on my hard drive with the actual data.
Came around for some help as spatial is something I don't normally have reason to do.
Things that tripped me up:
I kept changing too many things on the spatial tools at one time. So it kept not working.
These Advent of Code challenges are always a fun way to test different approaches in Alteryx. Looking forward to seeing how others tackle it and comparing solutions.
Day 9 is officially in the books! This was a really cool challenge, and yet another opportunity to get some practice with some seldom-used tools. We are now 3/4 done with AoC!
My Solutions
My Reflection:
Since I take to Spatial tools about as well as vampires take to garlic, I only used one! And it wasn't the spatial match tool either!
Really need to learn more about Spatial Tools. 😁
I was surprised that the Spatial tools didn't return the correct answer.
Part 1 solved.. not sure on part 2.
Today the strangest thing happened to me. Part 1 solved easily with Spatial tools. And without (you can generate all of the points in an area with two generate rows tools, but that's TORTOISE levels of slow.My spatial approach looked valid. Checked everything multiple times. All was in order. Thought perhaps I had exceeded the limit of integer spatial points, but nope. Thought I had forgotten to set data types correctly. Nope.Before going the slow route, recreated my part 2 in a new workflow. Step for step, the same. And tada! The answer was correct. Somehow the first and second largest were inverted in the first workflow. Same exact tools, same exact order. Same formulas came up with different values for the combination of points.I have to delete and burn my first workflow. Clearly, it's cursed.
Straightforward spatial analysis. Don't forget that the lat/lon are integers.
I can't upload my workflow from my work computer. Will do so when I recreate on my home laptop
My Day 9 solution!
Here's my day 9 workflow. I faced similar challenges to others with fractional overhang on some of the regions, but still loved the opportunity to use the spatial tools again!
Solution attached!
Pt 1 : OK ---- PT 2: Spatial Tools madness!! And then a Pac-man!! And some other overlapping issues.
Pt2
Lovely, lovely...