Want to get involved? We're always looking for ideas and content for Weekly Challenges.
SUBMIT YOUR IDEAThis one took me a while but I'm pleased with the outcome. Rather than simply plotting the lines I decided to use the northern and southern limits to create a polygon representing the area of totality.
If the user selects a point within the totality, a distance of 0 is returned, and if they select a point outside of the totality the smallest distance to the area of totality is returned.
I decided not to limit the region to the US mainland as that resulted in some coastal regions not being properly covered by the polygon. Another option would have been to keep the first point outside the US mainland but that seemed like overkill.
Here's my solution: