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

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 #269: Population DenCities

AYXAcademy
Alteryx
Alteryx

A solution to last week's challenge can be found here269_image.png

 

This week's challenge was submitted by @BeginnerMindset  - Thank you for your submission!

 

When we’re building spatial models or performing geospatial analysis, we often need to work with centroids; in general terms, this can be defined as the centre of mass for the polygon assuming uniform density. In other words, it’s just “a dot in the middle” of whatever unit of geography we are using. However, it is usually important that we use a population-weighted centroid, which might be quite different. We’re also interested in the demographics (eg. age, life-stage, affluence) - we want to know “who lives where” and ultimately “where do our target customers live?”

 

This is a three part challenge:
   1. Map the (unweighted) centroids of each country in the UK (Beginner)
   2. Map the population-weighted centroids for England and Wales. How far away are they from the unweighted centroids (in miles) and which cardinal direction? (Intermediate)
   3. Investigate how the Over 65s are spread across England and Wales. (Advanced)
       a) First calculate the percent of Over 65s within each Local Authority (LA).
       b) Create a thematic map to pick out the patterns. Modify the settings (colours, bands, borders) to paint a clearer picture. Include a title and a footer for the ONS copyrights.
       c) How does the proportion of Over 65s correlate with population density. Create a scatterplot and calculate the Pearson and Spearman correlations. Is there a strong relationship? Is it linear?

 

Note: all the data is from the ONS (Office for National Statistics) and is released under the terms of an Open Government License, so it is vital to include any relevant copyright statements if reproducing any maps or analysis that utilise this data.

See full details here: https://www.ons.gov.uk/methodology/geography/licences

patrick_digan
17 - Castor
17 - Castor

I've got the beginner and advanced so far. 

Spoiler
And the advanced was a bit of a punt because when I googled it, I saw there was already a crew macro...
patrick_digan_0-1621865936204.png

 

Kenda
16 - Nebula
16 - Nebula
Spoiler
stopped after intermediate 
Kenda_0-1621869225322.png

 

AkimasaKajitani
17 - Castor
17 - Castor

My solution.

 

Spoiler
I got the hint by Weight Average of Crew Macro. I found out about it through @patrick_digan 's comment.
I would not have been able to reach the result without the hint!

 

Workflow : 

Spoiler


AkimasaKajitani_5-1621872572054.png

 

I was taken to the wrong answer by Spatial Match tool, so I replace it to Join tool.

 

 

Result :

 

Spoiler
Task 1
AkimasaKajitani_1-1621872112963.png


Task 2

AkimasaKajitani_2-1621872214077.png


Task 3

AkimasaKajitani_4-1621872364064.png

 



AkimasaKajitani_3-1621872242201.png

 

 

PhilipMannering
16 - Nebula
16 - Nebula

Definitely feeling dense trying to get the answer. I also stopped at the intermediate answer.

 

Spoiler
PhilipMannering_0-1621873703085.png

 

DeanWest
9 - Comet

All three tasks completed!

Spoiler
challenge_269_solution_DeanWest-snippet.PNG
apathetichell
19 - Altair
Spoiler
I spent way too much time debugging why I had the wrong y-coordinate for the population centroid... Forgot that I had to switch from an append to a join when I broke out both Welsh and English data... That's why there are so many random extra browses trying to figure out why the Y-coord was wrong...

All 3 done. Got lazy on the report... No one is going the generate rows route for population center? Some sanity exists...

dsmdavid
11 - Bolide

There are some tools that I never remember... (looking at you, x̄)

 

Spoiler
dsmdavid_0-1621895990933.png

 

Qiu
21 - Polaris
21 - Polaris

Save the advanced for another day!😁

I think the key for Intermediate is understanding of how to calculate the population-weighted centroids.

 

Spoiler
challenge_269.PNGchallenge_269-1.PNG
balajilolla
8 - Asteroid
Spoiler
Task 1

balajilolla_0-1621906751808.png

 

Spoiler
Task 2
balajilolla_1-1621906790306.png

 

Spoiler
Task 3
balajilolla_2-1621906820838.png

 

balajilolla_3-1621906909579.png