My map contains a list of 3000 weather stations. The current JSON file driving the map contains lines like “KSQL”:[-122.25,37.52,”San Carlos Airport”]. It’s 137k, or 53k gzipped. That’s 46 bytes / station, or 18 bytes/station gzipped.

I’d like to add data to this file: the probability of wind coming from each of 12 directions. Probabilities can be scaled to [0-99] so the naive text encoding (32,4,12) is 24-36 bytes. That adds 50% to my file length. I actually tried it: the file becomes 210k, 80k gzipped.

I could do a more compressed encoding, say ASCII characters from 35 to 126 for 92 distinct values in one byte with no JSON encoding challenges. That gets me to 12 bytes / station, the whole file should be 160k.

My original plan was not to ship the wind probabilities at all, but render them server-side as PNGs (see previous posts). But each PNG is about 1k compared to 12 bytes for the wind data. And while bltting a PNG ought to be faster for the browser than drawing a bunch of SVG, it may not be significantly faster. Particularly since each PNG would need to be fetched as a separate file and it’s being rendered as an svg:image anyway. Need to test.