terracotta


Nameterracotta JSON
Version 0.8.2 PyPI version JSON
download
home_pagehttps://github.com/DHI-GRAS/terracotta
SummaryA modern XYZ tile server written in Python
upload_time2024-01-07 23:47:40
maintainer
docs_urlNone
authorJonas Sølvsteen
requires_python>=3.8
license
keywords xyz tileserver rasterio cloud-optimized-geotiff serverless
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            [![Tests](https://github.com/DHI-GRAS/terracotta/actions/workflows/test.yml/badge.svg)](https://github.com/DHI-GRAS/terracotta/actions/workflows/test.yml)
[![Documentation Status](https://readthedocs.org/projects/terracotta-python/badge/?version=latest)](https://terracotta-python.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/DHI-GRAS/terracotta/branch/main/graph/badge.svg?token=u16QBwwvvn)](https://codecov.io/gh/DHI-GRAS/terracotta)
[![GitHub release](https://img.shields.io/github/release-pre/dhi-gras/terracotta.svg)](https://github.com/DHI-GRAS/terracotta/releases)
[![PyPI release](https://img.shields.io/pypi/v/terracotta.svg)](https://pypi.org/project/terracotta)
[![License](https://img.shields.io/github/license/dhi-gras/terracotta.svg)](https://github.com/DHI-GRAS/terracotta/blob/main/LICENSE)
[![Python versions](https://img.shields.io/pypi/pyversions/terracotta.svg)](https://pypi.org/project/terracotta)

[![Logo](https://github.com/DHI-GRAS/terracotta/raw/main/docs/_figures/logo-banner.svg)](#)

Terracotta is a pure Python tile server that runs as a WSGI app on a
dedicated webserver or as a serverless app on AWS Lambda. It is built on a
modern Python stack, powered by awesome open-source software such as
[Flask](http://flask.pocoo.org), [Zappa](https://github.com/Miserlou/Zappa),
and [Rasterio](https://github.com/mapbox/rasterio).

[Read the docs](https://terracotta-python.readthedocs.io/en/latest) |
[Explore the API](https://terracotta-python.readthedocs.io/en/latest/apidoc.html) |
[Satlas, powered by Terracotta](http://satlas.dk)

## Why Terracotta?

- It is trivial to get going. Got a folder full of
  [cloud-optimized GeoTiffs](https://www.cogeo.org/) in different
  projections you want to have a look at in your browser?
  `terracotta serve -r {name}.tif` and
  `terracotta connect localhost:5000` get you there.
- We make minimal assumptions about your data, so *you stay in charge*.
  Keep using the tools you know and love to create and organize your
  data, Terracotta serves it exactly as it is.
- Serverless deployment is a first-priority use case, so you don’t have
  to worry about maintaining or scaling your architecture.
- Terracotta instances are self-documenting. Everything the frontend
  needs to know about your data is accessible from only a handful of
  API endpoints.

## The Terracotta workflow

### 1. Optimize raster files

```bash
$ ls -lh
total 1.4G
-rw-r--r-- 1 dimh 1049089 231M Aug 29 16:45 S2A_20160724_135032_27XVB_B02.tif
-rw-r--r-- 1 dimh 1049089 231M Aug 29 16:45 S2A_20160724_135032_27XVB_B03.tif
-rw-r--r-- 1 dimh 1049089 231M Aug 29 16:46 S2A_20160724_135032_27XVB_B04.tif
-rw-r--r-- 1 dimh 1049089 231M Aug 29 16:56 S2A_20170831_171901_25XEL_B02.tif
-rw-r--r-- 1 dimh 1049089 231M Aug 29 16:57 S2A_20170831_171901_25XEL_B03.tif
-rw-r--r-- 1 dimh 1049089 231M Aug 29 16:57 S2A_20170831_171901_25XEL_B04.tif

$ terracotta optimize-rasters *.tif -o optimized/

Optimizing rasters: 100%|██████████████████████████| [05:16<00:00, file=S2A_20170831_...25XEL_B04.tif]
```

### 2. Create a database from file name pattern

```bash
$ terracotta ingest optimized/S2A_{date}_{}_{tile}_{band}.tif -o greenland.sqlite
Ingesting raster files: 100%|███████████████████████████████████████████| 6/6 [00:49<00:00,  8.54s/it]
```

### 3. Serve it up

```bash
$ terracotta serve -d greenland.sqlite
 * Serving Flask app "terracotta.server" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://localhost:5000/ (Press CTRL+C to quit)
```

### 4. Explore the running server

#### Manually

You can use any HTTP-capable client, such as `curl`.
```bash
$ curl localhost:5000/datasets?tile=25XEL
{"page":0,"limit":100,"datasets":[{"date":"20170831","tile":"25XEL","band":"B02"},{"date":"20170831","tile":"25XEL","band":"B03"},{"date":"20170831","tile":"25XEL","band":"B04"}]}
```

Modern browsers (e.g. Chrome or Firefox) will render the JSON as a tree.

#### Interactively

Terracotta also includes a web client. You can start the client (assuming the server is running at http://localhost:5000) using
```bash
$ terracotta connect localhost:5000
 * Serving Flask app "terracotta.client" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:5100/ (Press CTRL+C to quit)
```

Then open the client page (http://127.0.0.1:5100/ in this case) in your browser.

![preview](https://github.com/DHI-GRAS/terracotta/raw/main/docs/_figures/workflow-preview.png)

## Development

We gladly accept [bug reports](https://github.com/DHI-GRAS/terracotta/issues)
and [pull requests](https://github.com/DHI-GRAS/terracotta/pulls) via GitHub.
For your code to be useful, make sure that it is covered by tests and that
it satisfies our linting practices (via `mypy` and `flake8`).

To run the tests, just install the necessary dependencies via

```bash
$ pip install -e .[test]
```

Then, you can run

```bash
$ pytest
```

from the root of the repository.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/DHI-GRAS/terracotta",
    "name": "terracotta",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "xyz tileserver rasterio cloud-optimized-geotiff serverless",
    "author": "Jonas S\u00f8lvsteen",
    "author_email": "josl@dhigroup.com",
    "download_url": "https://files.pythonhosted.org/packages/4a/12/0ea4e36d0064c75981bbbaf736466b7a722618d2dbbd7b23fecbbdd1ca8e/terracotta-0.8.2.tar.gz",
    "platform": null,
    "description": "[![Tests](https://github.com/DHI-GRAS/terracotta/actions/workflows/test.yml/badge.svg)](https://github.com/DHI-GRAS/terracotta/actions/workflows/test.yml)\n[![Documentation Status](https://readthedocs.org/projects/terracotta-python/badge/?version=latest)](https://terracotta-python.readthedocs.io/en/latest/?badge=latest)\n[![codecov](https://codecov.io/gh/DHI-GRAS/terracotta/branch/main/graph/badge.svg?token=u16QBwwvvn)](https://codecov.io/gh/DHI-GRAS/terracotta)\n[![GitHub release](https://img.shields.io/github/release-pre/dhi-gras/terracotta.svg)](https://github.com/DHI-GRAS/terracotta/releases)\n[![PyPI release](https://img.shields.io/pypi/v/terracotta.svg)](https://pypi.org/project/terracotta)\n[![License](https://img.shields.io/github/license/dhi-gras/terracotta.svg)](https://github.com/DHI-GRAS/terracotta/blob/main/LICENSE)\n[![Python versions](https://img.shields.io/pypi/pyversions/terracotta.svg)](https://pypi.org/project/terracotta)\n\n[![Logo](https://github.com/DHI-GRAS/terracotta/raw/main/docs/_figures/logo-banner.svg)](#)\n\nTerracotta is a pure Python tile server that runs as a WSGI app on a\ndedicated webserver or as a serverless app on AWS Lambda. It is built on a\nmodern Python stack, powered by awesome open-source software such as\n[Flask](http://flask.pocoo.org), [Zappa](https://github.com/Miserlou/Zappa),\nand [Rasterio](https://github.com/mapbox/rasterio).\n\n[Read the docs](https://terracotta-python.readthedocs.io/en/latest) |\n[Explore the API](https://terracotta-python.readthedocs.io/en/latest/apidoc.html) |\n[Satlas, powered by Terracotta](http://satlas.dk)\n\n## Why Terracotta?\n\n- It is trivial to get going. Got a folder full of\n  [cloud-optimized GeoTiffs](https://www.cogeo.org/) in different\n  projections you want to have a look at in your browser?\n  `terracotta serve -r {name}.tif` and\n  `terracotta connect localhost:5000` get you there.\n- We make minimal assumptions about your data, so *you stay in charge*.\n  Keep using the tools you know and love to create and organize your\n  data, Terracotta serves it exactly as it is.\n- Serverless deployment is a first-priority use case, so you don\u2019t have\n  to worry about maintaining or scaling your architecture.\n- Terracotta instances are self-documenting. Everything the frontend\n  needs to know about your data is accessible from only a handful of\n  API endpoints.\n\n## The Terracotta workflow\n\n### 1. Optimize raster files\n\n```bash\n$ ls -lh\ntotal 1.4G\n-rw-r--r-- 1 dimh 1049089 231M Aug 29 16:45 S2A_20160724_135032_27XVB_B02.tif\n-rw-r--r-- 1 dimh 1049089 231M Aug 29 16:45 S2A_20160724_135032_27XVB_B03.tif\n-rw-r--r-- 1 dimh 1049089 231M Aug 29 16:46 S2A_20160724_135032_27XVB_B04.tif\n-rw-r--r-- 1 dimh 1049089 231M Aug 29 16:56 S2A_20170831_171901_25XEL_B02.tif\n-rw-r--r-- 1 dimh 1049089 231M Aug 29 16:57 S2A_20170831_171901_25XEL_B03.tif\n-rw-r--r-- 1 dimh 1049089 231M Aug 29 16:57 S2A_20170831_171901_25XEL_B04.tif\n\n$ terracotta optimize-rasters *.tif -o optimized/\n\nOptimizing rasters: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| [05:16<00:00, file=S2A_20170831_...25XEL_B04.tif]\n```\n\n### 2. Create a database from file name pattern\n\n```bash\n$ terracotta ingest optimized/S2A_{date}_{}_{tile}_{band}.tif -o greenland.sqlite\nIngesting raster files: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 6/6 [00:49<00:00,  8.54s/it]\n```\n\n### 3. Serve it up\n\n```bash\n$ terracotta serve -d greenland.sqlite\n * Serving Flask app \"terracotta.server\" (lazy loading)\n * Environment: production\n   WARNING: Do not use the development server in a production environment.\n   Use a production WSGI server instead.\n * Debug mode: off\n * Running on http://localhost:5000/ (Press CTRL+C to quit)\n```\n\n### 4. Explore the running server\n\n#### Manually\n\nYou can use any HTTP-capable client, such as `curl`.\n```bash\n$ curl localhost:5000/datasets?tile=25XEL\n{\"page\":0,\"limit\":100,\"datasets\":[{\"date\":\"20170831\",\"tile\":\"25XEL\",\"band\":\"B02\"},{\"date\":\"20170831\",\"tile\":\"25XEL\",\"band\":\"B03\"},{\"date\":\"20170831\",\"tile\":\"25XEL\",\"band\":\"B04\"}]}\n```\n\nModern browsers (e.g. Chrome or Firefox) will render the JSON as a tree.\n\n#### Interactively\n\nTerracotta also includes a web client. You can start the client (assuming the server is running at http://localhost:5000) using\n```bash\n$ terracotta connect localhost:5000\n * Serving Flask app \"terracotta.client\" (lazy loading)\n * Environment: production\n   WARNING: Do not use the development server in a production environment.\n   Use a production WSGI server instead.\n * Debug mode: off\n * Running on http://127.0.0.1:5100/ (Press CTRL+C to quit)\n```\n\nThen open the client page (http://127.0.0.1:5100/ in this case) in your browser.\n\n![preview](https://github.com/DHI-GRAS/terracotta/raw/main/docs/_figures/workflow-preview.png)\n\n## Development\n\nWe gladly accept [bug reports](https://github.com/DHI-GRAS/terracotta/issues)\nand [pull requests](https://github.com/DHI-GRAS/terracotta/pulls) via GitHub.\nFor your code to be useful, make sure that it is covered by tests and that\nit satisfies our linting practices (via `mypy` and `flake8`).\n\nTo run the tests, just install the necessary dependencies via\n\n```bash\n$ pip install -e .[test]\n```\n\nThen, you can run\n\n```bash\n$ pytest\n```\n\nfrom the root of the repository.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A modern XYZ tile server written in Python",
    "version": "0.8.2",
    "project_urls": {
        "Homepage": "https://github.com/DHI-GRAS/terracotta"
    },
    "split_keywords": [
        "xyz",
        "tileserver",
        "rasterio",
        "cloud-optimized-geotiff",
        "serverless"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a120ea4e36d0064c75981bbbaf736466b7a722618d2dbbd7b23fecbbdd1ca8e",
                "md5": "bfaff1d64d1778dd7a46f0ef7bd67e8d",
                "sha256": "dad456c8ffcfe1cc30cf37d48c73d7da8081eda5357421b0b5a2b9d4d4639bd3"
            },
            "downloads": -1,
            "filename": "terracotta-0.8.2.tar.gz",
            "has_sig": false,
            "md5_digest": "bfaff1d64d1778dd7a46f0ef7bd67e8d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 3658702,
            "upload_time": "2024-01-07T23:47:40",
            "upload_time_iso_8601": "2024-01-07T23:47:40.762406Z",
            "url": "https://files.pythonhosted.org/packages/4a/12/0ea4e36d0064c75981bbbaf736466b7a722618d2dbbd7b23fecbbdd1ca8e/terracotta-0.8.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-07 23:47:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DHI-GRAS",
    "github_project": "terracotta",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "terracotta"
}
        
Elapsed time: 0.20796s