alteryx Community

# 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.

## Challenge #269: Population DenCities

Alteryx

A solution to last week's challenge can be found here

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

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...

16 - Nebula
Spoiler
stopped after intermediate

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

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

Result :

Spoiler

16 - Nebula

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

Spoiler

9 - Comet

Spoiler
18 - Pollux
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...

11 - Bolide

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

Spoiler

20 - Arcturus

Save the advanced for another day!😁

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

Spoiler
8 - Asteroid
Spoiler

Spoiler