Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #161: Triangles, Triangles, Triangles

TonyA
Alteryx Alumni (Retired)

Here's my solution. Had a lot of fun playing with various sorts on the final data set, trying to figure out how to match the image (area, min X, min Y in ascending and descending order). Came up with some interesting patterns, especially the last two which are sorted on area in ascending and descending order. But I couldn't find the sort order that matched the image.

Triangles.jpg

Also learned a few interesting things looking at the solution:

Spoiler
I didn't realize you could do comparisons on polygons. I thought that Alteryx was comparing the underlying GeoJSON so the order of the points would matter. Apparently it's smarter than that, which makes the problem a lot simpler. Another thing that makes my workflow longer is that I tried to stick to what I thought was the spirit of the exercise and use spatial tools instead of formulas whenever possible.

 

Martyn
9 - Comet
Spoiler
clipboard_image_0.png
CliffordC
Alteryx Alumni (Retired)
 
rougeau14
6 - Meteoroid
Spoiler
clipboard_image_0.png

My associate @CharlieS came up with this one!

bnelly1987
8 - Asteroid

Solution-Challenge 161.PNG

hanykowska
11 - Bolide

Definitely not an optimal solution, but, hey, it works!

 

Spoiler
image.png
meganhan
7 - Meteor
 
garthn555
8 - Asteroid

The extra 21 objects (537-516) seem to be true triangles - the nulls are lines. (I added collinear test records to check). So does that mean if 3 collinear points are used in st_createpolygon that it won't produce a spatial object?

CharlieS
17 - Castor
17 - Castor

@garthn555 wrote:

The extra 21 objects (537-516) seem to be true triangles - the nulls are lines. (I added collinear test records to check). So does that mean if 3 collinear points are used in st_createpolygon that it won't produce a spatial object?


Yes, 3 perfectly collinear spatial points will yield "ST_CreatePolygon: Failed to form valid polygon."

 

That being said, the issue with this scenario is introduced by the Make Grid tool and the issues of plotting a flat plane to a curved surface. The grid points are not technically collinear, but practically they are, and therein lies the issue. 

ddiesel
13 - Pulsar
13 - Pulsar

I was stuck for the longest time at 540 triangles before I peeked at the solution to see that the area tolerance was set to > .1 sq miles.

 

My solution:

 

Spoiler
Capture1.JPGCapture.JPG