CMU-CREATE-Lab / data-visualization-tools

EarthTime, and various data visualization libraries
Other
14 stars 5 forks source link

Large Choropleths Cause Chrome to Crash #196

Open jjkohler opened 3 years ago

jjkohler commented 3 years ago

https://staging.earthtime.org/explore#waypoints=1heLmeuPp7j4itr0cK8H4chugOpp7cU8p_VEB9CFfPlY.0&#v=152795,364832,1994398,1400734,pts&t=0&ps=50&l=maddison_project_cgdppc,bdrk,WITS_Deficits_US_all_products&bt=19910101&et=20161231&startDwell=0&endDwell=1&fps=30

You will see your Chrome tab crash after a few seconds.

You will only see red and black bubbles, but what is missing from what you see is that there is actually a third layer loading behind the scenes. And this layer is a giant chorolpleth layer: maddison_project_cgdppc

This layer's time range covers 1800 to 2016 and Chrome will crash. We have a couple dozen or so of these large choropleths that will crash Chrome, but not another browser like FireFox. The reason for this is that Chrome has a max heap size of ~1GB and we exceed this when loading a layer like this. FireFox, on the other hand, has a larger default heap size and thus does not crash. Our binary choropleths method (or mapbox) is the only solution.

Or decrease detail of the layer.

Current proposed fix by @rsargent is to decrease the geojson complexity

jjkohler commented 3 years ago

This issue is not unique to staging but exists in base ET as well: https://earthtime.org/explore#v=-2.28999,0,-0.34,latLng&t=3.16&ps=50&l=bdrk,us_ipums_all_pop_1790_1890_county&bt=17900101&et=18901231&startDwell=0&endDwell=0

data layer: us_ipums_all_pop_1790_1890_county

https://tiles.earthtime.org/regions/us_counties/US_county_1890_ms10.geojson

joined with this CSV: https://tiles.earthtime.org/regions/us_counties/all_pop_1790_1890_county.csv

12 years worth of data for 2858 counties

rsargent commented 3 years ago

layer maddison_project_cgdppc (top waypoint 140) From https://api.earthtime.org/layer-catalogs/1rCiksJv4aXi1usI0_9zdl4v5vuOfiHgMRidiDPt1WfE.870361385/layers/maddison_project_cgdppc:

URL: https://docs-proxy.cmucreatelab.org/spreadsheets/d/1he-IZyCoMkhxUS3VRSSeQiW2lt5DBkufckMtT1BHnfs/export?format=csv&gid=450088725

Years 1, 730, 1000, 1150, then 1280-2016. Lots of columns

geojson appears to be the default per-country geojson

pdille commented 3 years ago

I mention this awhile back in issue #110

Decreasing geometry detail or using binned choropleths are the solution.

pdille commented 3 years ago

Also, I'm not sold on lowering the detail of the geometry as a fully encompassing solution here. How much do we know to cut on the detail for the different layers? Some span dozens of frames. Some more, some less. Do we have to keep lowering details as the dataset gets larger and larger? I have at least one layer that is for every country in the world and every month I add more data to it (school closure policies).

This is where the binned choropleths were something I was hoping to explore more.

rsargent commented 3 years ago

We could also temporarily switch to bubbles for the large layers until we in the future either switch to binary or mbtile choropleths.

An advantage to a temporary solution like this is that we fix both staging and production without needing to port the feature.

rsargent commented 3 years ago

Gabriel suggests porting JSON choropleths to use shaders that were developed for binary-tile, as they're much more memory efficient.