Skip to content

Task 2 solution#2

Open
ChrisSoderberg-ONS wants to merge 6 commits intomainfrom
task-2-solution
Open

Task 2 solution#2
ChrisSoderberg-ONS wants to merge 6 commits intomainfrom
task-2-solution

Conversation

@ChrisSoderberg-ONS
Copy link
Copy Markdown
Owner

@ChrisSoderberg-ONS ChrisSoderberg-ONS commented Mar 26, 2025

Here's my solution for task 2.

The original intention was to use flask to collect data from the client (web browser) side of the app, perform the data processing to generate a new folium map on the server side, and send it back to the client. This proved far trickier than anticipated and probably isn't actually the best way to go about this (it doesn't sound very scalable), a much easier workaround was to generate all the different maps needed in advance and store them in the web application's static data folder. Then we just use javascript to select which version of the map we want based on the slider value, so everything is happening on the client side (I think)

The major problem is the loading time of the new map, it looks quite bad when the slider is moved. There's a recent article in the Independent where the data journalist who worked on the article ran into the same problem and also couldn't figure out how to fix it: https://www.independent.co.uk/news/uk/home-news/house-prices-growth-renting-increase-uk-b2721895.html

I don't think this is a trivial problem, it's probably related to Folium/Leaflet itself not really being designed for being used like this. A bespoke choropleth map with less overhead than Folium/Leaflet (e.g. no interactivity or animations) would be the quickest solution to this

Comment thread templates/home.html
var output = document.getElementById("outputValue");

let filepath_start = "/static/map_";

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should replace var with let for consistency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant