mapbox / landsat-tiler

A serverless Landsat tiles server using AWS Lambda
BSD 3-Clause "New" or "Revised" License
143 stars 24 forks source link

adapt to rio-tiler 1.0.0 #7

Closed vincentsarago closed 6 years ago

vincentsarago commented 6 years ago

see https://github.com/mapbox/rio-tiler/pull/6

vincentsarago commented 6 years ago

There are some weird things happening !

What

capture d ecran 2017-12-05 a 18 43 43

I've been noticing random black tiles when playing with the demo at viewer.remotepixel.ca. Those tiles seemed to appear when doing a lot of panning.

Then I noticed something really strange 👇

gif

This is what append when you call the same tile twice in a row (using hot lambda container). So basically, when calling for a tile ta first it will work but then some caching mechanism will return black tiles for all latest calls.

something is happening here: https://github.com/mapbox/landsat-tiler/blob/65072ecae93aab153fd820dc0ca4d605777a409c/app/landsat.py#L91-L100

👇 this is a log for the 2 consecutive request where I'm logging the min and max of the tile variable

01:23:43 START RequestId: 420ad5b2-daed-11e7-82a7-2f2cc7d38d3b Version: $LATEST
01:23:44 [landsat-tiler] - [DEBUG] - 380 - 1263 #before rescaling
01:23:44 [landsat-tiler] - [DEBUG] - 22 - 157  #after rescaling
01:23:44 END RequestId: 420ad5b2-daed-11e7-82a7-2f2cc7d38d3b

01:23:46 START RequestId: 4577e8af-daed-11e7-9995-190fb543c25f Version: $LATEST
01:23:46 [landsat-tiler] - [DEBUG] - 22 - 157 #before rescaling
01:23:46 [landsat-tiler] - [DEBUG] - 1 - 1 #after rescaling
01:23:46 END RequestId: 4577e8af-daed-11e7-9995-190fb543c25f

Basically the variable tile is cached and get reused and rescaled again 🎉