In typical HN fashion, I would suggest looking into Tippecanoe to generate some vector tiles of the data and host that on S3. You can then have the DB perform simple lookups via the accident ID.
If the bottle-neck is the DB and you haven't enabled the PostGIS extension, I'd look into that as the other commenter mentioned. If it's your server, then yes look into pre-generating all the tiles and hosting them elsewhere, but this might then mean switching over to MapLibre/Mapbox (which is what most companies end up using because of Leaflet's limitations).
For filtering on the frontend, I'd look into Expressions so you're not regenerating the GeoJSON collection every time (this causes a significant delay and flicker).
- https://maplibre.org/maplibre-style-spec/expressions/
- https://maplibre.org/maplibre-gl-js/docs/examples/hover-styl...
Is your server on that list?
j/k, I’m sorry, I’ll see myself out XD
We were also recently featured on the motherduck blog https://motherduck.com/blog/pushing-geo-boundaries-with-moth...