question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reproducing TileOutsideBounds errors

See original GitHub issue

I did this exact set of instructions (twice), and was able to reproduce a TileOutsideBounds error

Clone repo

git clone https://github.com/developmentseed/titiler
cd titiler

Build docker image:

docker build --tag titiler-lambda:latest . -f Dockerfiles/lambda/Dockerfile --no-cache

Extract package.zip locally

docker run --name titiler-lambda --volume $(pwd)/:/local -it titiler-lambda:latest bash -c 'cp /tmp/package.zip /local/package.zip'

Install serverless-offline

yarn add serverless-offline
# or
npm install serverless-offline

Paste the following into serverless.yml locally in the titiler folder (as an aside, I’d consider adding a page in the docs for deploying with Serverless framework basically with these steps)…

Content
service: titiler-lambda-sls

plugins:
  - serverless-offline

custom:
  serverless-offline:
    useChildProcesses: true
    allowCache: true
    useDocker: true

provider:
  name: aws
  runtime: python3.7
  stage: ${opt:stage, 'dev'}
  region: "us-west-2"

  deploymentBucket: ${opt:bucket}
  httpApi:
    cors: true

  # Add Tags to resources
  stackTags:
    Project: titiler

  apiGateway:
    binaryMediaTypes:
      - "*/*"
    minimumCompressionSize: 1

  # Add other buckets here if needed
  iamRoleStatements:
    - Effect: "Allow"
      Action:
        - "s3:GetObject"
        - "s3:HeadObject"
        - "s3:PutObject"
      Resource:
        - "arn:aws:s3:::${self:provider.deploymentBucket}*"

    - Effect: "Allow"
      Action:
        - "s3:GetObject"
        - "s3:HeadObject"
      Resource:
        - "arn:aws:s3:::*"

package:
  artifact: package.zip

functions:
  app:
    handler: handler.handler
    memorySize: 3008
    timeout: 10
    environment:
      # Necessary since NAIP bucket is requester-pays
      AWS_REQUEST_PAYER: requester
      AWS_ACCOUNT_ID: ${env:AWS_ACCOUNT_ID}
      AWS_ACCESS_KEY_ID: ${env:AWS_ACCESS_KEY_ID}
      AWS_SECRET_ACCESS_KEY: ${env:AWS_SECRET_ACCESS_KEY}
      AWS_REGION: ${env:AWS_REGION}
      CACHE_CONTROL: ${opt:cache-control, 'public,max-age=3600'}
      CPL_TMPDIR: /tmp
      CPL_VSIL_CURL_ALLOWED_EXTENSIONS: .tif,.TIF
      GDAL_CACHEMAX: 25%
      # https://github.com/OSGeo/gdal/issues/909#issuecomment-420036545
      GDAL_DISABLE_READDIR_ON_OPEN: EMPTY_DIR
      GDAL_HTTP_MERGE_CONSECUTIVE_RANGES: YES
      GDAL_HTTP_MULTIPLEX: YES
      GDAL_HTTP_VERSION: 2
      MAX_THREADS: 1
      PYTHONWARNINGS: ignore
      VSI_CACHE: TRUE
      VSI_CACHE_SIZE: 536870912
    events:
      - httpApi:
          path: /{proxy+}
          method: "*"

Start serverless-offline

export AWS_ACCOUNT_ID=...
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_REGION=...

sls offline --bucket some-bucket-of-yours

Go to this address: (note this may take a little while to load the first time because serverless-offline does something with docker in the background). This is pulling from a mosaic that should be fully public.

http://localhost:3000/dev/mosaicjson/tiles/16/12406/25717.npy?url=s3%3A%2F%2Ftmp-us-west-2-kylebarron%2Ftmp%2Fnaip-analytic-mosaic.json.gz&scale=1&return_mask=True

And I get:

{"detail":"Tile 16/12406/25717 is outside image bounds"}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
vincentsaragocommented, Oct 6, 2020
1reaction
kylebarroncommented, Oct 3, 2020

At the end of the first post I shared a link that doesn’t work. That includes one x/y/z and a public mosaic

can you run the cogeo-mosaic code itself outside the app?

Hmm good question

Read more comments on GitHub >

github_iconTop Results From Across the Web

rio_tiler.errors - rio-tiler
User friendly Rasterio plugin to read raster datasets.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found