Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Spatial brain teaser

DavidP
17 - Castor
17 - Castor

Hi folks,

 

I have a spatial brain teaser for you guys, but it's more of a logic problem.

 

(For the prospective Advent of Coders, this is good practice for the imminent challenge ahead!!!)

 

I have around 850 data points that make up a shape. There are a few data points that don't belong as you can see in the image.

 

With the original dataset, Alteryx didn't know what sequence to use to turn the points into a polyline, so I built an iterative macro and used the find nearest tool to find the correct sequence (New RecordID). This worked pretty well for the most part, but when it gets to the top left corner (around row 725'ish - the sequence is anti-clockwise), it didn't make the decision I wanted (turn left), but instead carried on straight. I taught my iterative macro not to use any points it had already used, so in order for it not to just stop and start crying when it gets to a dead end, I increased the find nearest number to 40 (through trial and error). This allows it to jump back to a point not previously used and carry on.

 

The upshot is that it gets to the end (you can see a tiny gap between the start and end point), but my shape has 2 little wings that I want to get rid of.

 

I'm including the dataset with the point coordinates and my calculated sequence. The field [piece center] is an approximate center for the shape.

 

So for anyone looking to accept the challenge, I'm looking for a way to create a clean shape (polyline or polygon), either by removing the bits I don't want or by training Alteryx to go back to the crossroads and turn left instead of going straight!

 

 

puzzle piece workflow.png

 

 

 

 
 

 

4 REPLIES 4
gawa
16 - Nebula
16 - Nebula

hi @DavidP 

Nice warming-up toward AoC. My solution is a bit messy, but seems work well. 

1)Create poly-line objects by connecting the nearest two points

2)Crate a Rectangular object that covers the all of points

3) Buffering poly-line made in 1) and cut it from rectangular objects made in 2)

4) Split into polygon objects and get the target objects. Buffer it with the same parameter used in 3).

 

image.png

Qiu
21 - Polaris
21 - Polaris

@gawa 
Nice one. Really inspiring.

@DavidP 
I followed the simiar approaching with @gawa .
I think the basically the problem here is to identify isolate the points "don't belong as you can see in the image."

Instead of making a rectangular, I just go ahead and make a Convex hull with existing points.

puzzle piece challenge-r1.png

DavidP
17 - Castor
17 - Castor

Those are great solutions, @gawa and @Qiu !

 

For anyone interested in solving the sequencing challenge themselves, here's the unsorted dataset.

 

 

puzzle piece unsorted.png

Qiu
21 - Polaris
21 - Polaris

@DavidP 
It was a great one, not sure I did it correctly though.
Anyway, have you thought about submitting it as a weekly challenge idea?

Labels
Top Solution Authors