Home

Awesome

cogeo-tiler

CircleCI codecov

This project is a fork of https://github.com/vincentsarago/lambda-tiler

AWS Lambda + rio-tiler to serve tiles from any web hosted files

image_preview

cogeo-tiler is a simple serverless (AWS Lambda function) application that serves Map Tiles dynamically created from COGs hosted remotely (s3, http, ...)

Deploy

Requirement

Create the package

# Build Amazon linux AMI docker container + Install Python modules + create package
$ git clone https://github.com/developmentseed/cogeo-tiler.git
$ cd cogeo-tiler && make package

Deploy to AWS

To ease deployment (and to make package lighter) we are using lambgeo/geo-layer AWS Layer. The layer might not be available in all the region but you can deploy you own by following this steps

#configure serverless (https://serverless.com/framework/docs/providers/aws/guide/credentials/)
npm install
sls deploy

API

Swagger documentation: https://cog.cogeo.xyz/docs

TileJSON (2.1.0)

/tilejson.json - GET

Inputs:

Outputs:

$ curl https://{endpoint-url}/tilejson.json?url=https://any-file.on/the-internet.tif

{
    "bounds": [...],      
    "center": [..., ..., 18], 
    "minzoom": 18,        
    "maxzoom": 22,        
    "name": "the-internet.tif",
    "tilejson": "2.1.0",  
    "tiles": [...] ,      
}

Bounds

Inputs:

Outputs:

$ curl https://{endpoint-url}/bounds?url=https://any-file.on/the-internet.tif

{
  "url": "https://any-file.on/the-internet.tif", 
  "bounds": [...]
}

Metadata

/metadata - GET

Inputs:

Outputs:

$ curl https://{endpoint-url}/metadata?url=s3://url=https://any-file.on/the-internet.tif

{
    "address": "s3://myfile.tif",
    "band_descriptions": [(1, "red"), (2, "green"), (3, "blue"), (4, "nir")],
    "statistics": {
        "1": {
            "pc": [38, 147],
            "min": 20,
            "max": 180,
            "std": 28.123562304138662,
            "histogram": [
                [...],
                [...]
            ]
        },
        ...
    }
}

Tiles

/{z}/{x}/{y} - GET

/{z}/{x}/{y}.{ext} - GET

/{z}/{x}/{y}@{scale}x - GET

/{z}/{x}/{y}@{scale}x.{ext} - GET

Inputs:

Outputs:

$ curl {your-endpoint}/7/10/10.png?url=https://any-file.on/the-internet.tif

Note:

Docs

/docs - GET