I would like to share with you my app to visualize UK house prices and sales volume from 1995 to now.
The rendering of the choropleth is quite slow, sometimes reaching over 10 seconds (the actual calculation time in producing a figure object is around 2 sec). If you have any ideas how to speed this up (without switching to say scatter_mapbox for approximation) I’d love to hear from you.
Hope you find this useful.
Github: GitHub - ivanlai/Plotly-App-UK-houseprices: Plotly Web App for England and Wales Houseprices
Beautiful app! Love seeing these highly detailed choropleths, even if passing that much data over the wire is a little slow
I looks really cool! And i agree with @chriddyp, the choropleth visualization looks great. I can come think of a few options that might speed up the drawing. The first the is data reduction,
- Simplify the polygons (using e.g. Shapely)
- Remove properties that are not used form the GeoJSON
The second would be to use data compression such a geobuf. I am not sure if the Plotly component supports it, but dash-leaflet does. The size reduction depends a lot on the data, so as an initial test you could try simply to compress your GeoJSON to see how your data is affected.
Thanks Emil, I’ll have a go with your suggestions.
Simplifying the polygons really helped with loading speed. The polygons don’t fit so well in the dense area when zoomed in, but its a good trade off. Thanks for the advice.
One way to speed things up for the choropleth would be to drop your GeoJSON file into
/assets and then in the
geojson attribute of your trace just put the URL to that file like
"/assets/polygons.geojson". This would let the browser reuse the same object over and over again and make subsequent updates faster as only the new data goes over the wire and not the (unchanged, I assume) polygons.
It works great!! Now it’s quite responsive thanks to your excellent advice Nicolas.