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!
Solved! Go to Solution.
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).
@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?
User | Count |
---|---|
19 | |
15 | |
15 | |
9 | |
8 |