mapbox / rio-rgbify

Encoded arbitrary bit depth rasters in pseudo base-256
MIT License
99 stars 36 forks source link

Support 256 x 256 output tilesizes #9

Open dnomadb opened 6 years ago

dnomadb commented 6 years ago

In order to more easily stay under total and individual (tile) size limits, we should allow creation of mbtiles with 256x256 tiles in addition to 512x512.

jingsam commented 6 years ago

Note that mapbox.terrain-rgb uses 256.

dnomadb commented 6 years ago

Note that mapbox.terrain-rgb uses 256.

While the default tile endpoint is indeed 256, the full size tiles (@2x) are retina resolution at 512x512 (same for all of our raster tiles: https://www.mapbox.com/api-documentation/#retrieve-tiles -- they are resized on-the-fly).

512: https://api.mapbox.com/v4/mapbox.terrain-rgb/11/334/793@2x.pngraw?access_token=<token>

image

256: https://api.mapbox.com/v4/mapbox.terrain-rgb/11/334/793.pngraw?access_token=<token>

image

I'd guess that for hillshading 512 is overkill, but 512 tiles work great for other uses in order to make fewer calls to the api, eg: https://www.mapbox.com/labs/terra/#15.1541/-25.3483/131.0368/31.8413/36

jingsam commented 6 years ago

I think the default tileSize should be 512. As mapbox-gl-js uses 512 tiles, a 256 tile source would cause mapbox-gl-js request four 256-based tiles to compose a 512 tile. Not only more requests, but also the total size of tiles increase.