and if you're running a version of PostGIS with protobuffers enabled (Not AWS RDS) you can generate vector tiles on the fly with https://postgis.net/docs/ST_AsMVT.html which are great for displaying large datasets.
and if you're running a version of PostGIS with protobuffers enabled (Not AWS RDS) you can generate vector tiles on the fly with https://postgis.net/docs/ST_AsMVT.html which are great for displaying large datasets.
https://dba.stackexchange.com/questions/202049/support-for-l...
v10.5 of postgres by the looks of it, don't know how I missed that.
https://github.com/topojson/topojson-simplify
https://medium.com/@mbostock/command-line-cartography-part-1...
You'll need the MapboxVectorTiles plugin for leaflet but you can definitely improve the sizes by a fair bit.
I've done this for GeoJSON tiles for a long time, before the MVT tiles. The MVT tiles pack way more data though, but are not a solution to the O(n2) problem.
Another good option with many polygon geometries is Base64 encoding the output of ST_AsGeobuf -- it is many times smaller than GeoJSON and still pretty easy to handle from Javascript. (Needs libprotobuf-c on the PostGIS side and geobuf.js+pbf.js on the JS side)