Hacker News new | past | comments | ask | show | jobs | submit login

I hacked up a quick script and converted https://s3.amazonaws.com/elevation-tiles-prod/terrarium/0/0/... to 16-bit (2 channel) PNG.

Any value below sea level I set to 0. Any value above sea level I converted using the following formula:

scaled = elevation * Math.floor[(256 * 256) / (8849 - 0)];

top_byte = scaled / 256;

bottom_byte = scaled % 256;

This provides accuracy to 1/7th of a meter compared to 1/10th of a meter with Mapbox but the tile size went from 104KB -> 25KB. For applications that can ignore elevations below sea level, this is a huge savings.

Edit: the top level tile has a lot of ocean so the size savings are better than average. On a tile with no water, the savings appear to be around 50%.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: