London Traffic Accident Map

Hello all! First time making an app on Streamlit (or anywhere for that matter). Any comments, advice or questions very welcome.

Working on a project focused on time series modelling of traffic accident data in London, UK I got carried away with maps and visualisations, a couple of which are shown here.

https://traffax.herokuapp.com/

Adam

3 Likes

Welcome to the community @AdamPengilly !

I always love cartography apps :slight_smile: it does take a lot of time to load when I change the vehicle combination, is it because you are redownloading the data everytime?

Also I would love a legend next to the maps so I understand the scale of the colors, and maybe a bit of description in the beginning to explain what you do.

I love the name, “traffax” :p. Looking forward to seeing it evolve!

Cheers,
Fanilo

Hey @andfanilo,

Thanks for the feedback, much appreciated!

I tried a few ways to speed it up but this is the quickest I could make it as yet… The output from the vehicle selection is used to filter a pandas dataframe (~270,000 rows), from which the resulting latitude/longitude pairs are used for plotting/sorted into lists for the heat map.

I’ve cached the function which filters the dataframe so I believe it runs better once it’s seen the data, but it wasn’t possible - as far I could tell - to cache the Folium Heatmap function, which might be a factor.

The first plot might take a few seconds itself as there are a lot of points being plotted (270-540k), but like you I’m a sucker for a map and so have left it in :D.

Will try and tidy it up a bit. Thanks again!

Adam