diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index c8f9ee6..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[bumpversion] -current_version = 0.8.0a3 -commit = True -tag = True -tag_name = {new_version} - -[bumpversion:file:timvt/__init__.py] -search = __version__ = "{current_version}" -replace = __version__ = "{new_version}" diff --git a/.env.example b/.env.example deleted file mode 100644 index 583e88d..0000000 --- a/.env.example +++ /dev/null @@ -1,23 +0,0 @@ -# DB connection -POSTGRES_USER=username -POSTGRES_PASS=password -POSTGRES_DBNAME=postgis -POSTGRES_HOST=0.0.0.0 -POSTGRES_PORT=5432 - -# You can also define the DATABASE_URL directly -# DATABASE_URL=postgresql://username:password@0.0.0.0:5432/postgis - -# Tile settings -TIMVT_TILE_RESOLUTION=4096 -TIMVT_TILE_BUFFER=256 -TIMVT_MAX_FEATURES_PER_TILE=10000 - -# Default Table/Function min/max zoom -TIMVT_DEFAULT_MINZOOM=8 -TIMVT_DEFAULT_MAXZOOM=19 - -# TiMVT settings -TIMVT_NAME = "Fast MVT Server" -TIMVT_CORS_ORIGINS="*" -TIMVT_DEBUG=TRUE diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 71b4e2d..0000000 --- a/.flake8 +++ /dev/null @@ -1,5 +0,0 @@ -[flake8] -ignore = E501,W503,E203 -exclude = .git,__pycache__,docs/source/conf.py,old,build,dist -max-complexity = 12 -max-line-length = 90 diff --git a/.github/codecov.yml b/.github/codecov.yml deleted file mode 100644 index c61977e..0000000 --- a/.github/codecov.yml +++ /dev/null @@ -1,8 +0,0 @@ -comment: off - -coverage: - status: - project: - default: - target: auto - threshold: 5 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index e54907f..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,190 +0,0 @@ -name: CI - -# On every pull request, but only on push to master -on: - push: - branches: - - master - tags: - - '*' - paths: - # Only run test and docker publish if somde code have changed - - 'pyproject.toml' - - 'timvt/**' - - 'tests/**' - - '.pre-commit-config.yaml' - - 'dockerfiles/**' - pull_request: -env: - LATEST_PY_VERSION: '3.10' - -jobs: - tests: - runs-on: ubuntu-20.04 - strategy: - matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: install lib postgres - run: | - sudo apt update - wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O- | sudo apt-key add - - echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" | sudo tee /etc/apt/sources.list.d/postgresql.list - sudo apt update - sudo apt-get install --yes libpq-dev postgis postgresql-14-postgis-3 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install .["test"] - - - name: Run pre-commit - if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} - run: | - python -m pip install pre-commit codecov - pre-commit run --all-files - - - name: Run tests - run: python -m pytest --cov timvt --cov-report xml --cov-report term-missing - - - name: Upload Results - if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} - uses: codecov/codecov-action@v1 - with: - file: ./coverage.xml - flags: unittests - name: ${{ matrix.python-version }} - fail_ci_if_error: false - - benchmark: - needs: [tests] - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.LATEST_PY_VERSION }} - - - name: install lib postgres - run: | - sudo apt update - wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O- | sudo apt-key add - - echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" | sudo tee /etc/apt/sources.list.d/postgresql.list - sudo apt update - sudo apt-get install --yes libpq-dev postgis postgresql-14-postgis-3 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install .["test"] - - - name: Run Benchmark - run: python -m pytest tests/benchmarks.py --benchmark-only --benchmark-columns 'min, max, mean, median' --benchmark-json output.json - - # - name: Store and benchmark result - # uses: benchmark-action/github-action-benchmark@v1 - # with: - # name: TiMVT Benchmarks - # tool: 'pytest' - # output-file-path: output.json - # alert-threshold: '130%' - # comment-on-alert: true - # fail-on-alert: true - # # GitHub API token to make a commit comment - # github-token: ${{ secrets.GITHUB_TOKEN }} - # # Make a commit on `gh-pages` only if master - # auto-push: ${{ github.ref == 'refs/heads/master' }} - # benchmark-data-dir-path: benchmarks - - publish: - needs: [tests] - runs-on: ubuntu-latest - if: contains(github.ref, 'tags') && github.event_name == 'push' - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.LATEST_PY_VERSION }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install hatch - python -m hatch build - - - name: Set tag version - id: tag - run: | - echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT - - - name: Set module version - id: module - run: | - echo "version=$(hatch --quiet version)" >> $GITHUB_OUTPUT - - - name: Build and publish - if: ${{ steps.tag.outputs.version }} == ${{ steps.module.outputs.version}} - env: - HATCH_INDEX_USER: ${{ secrets.PYPI_USERNAME }} - HATCH_INDEX_AUTH: ${{ secrets.PYPI_PASSWORD }} - run: | - python -m hatch publish - - publish-docker: - needs: [tests] - if: github.ref == 'refs/heads/master' || startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to Github - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set tag version - id: tag - # https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions - run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} - - # Push `latest` when commiting to master - - name: Build and push - if: github.ref == 'refs/heads/master' - uses: docker/build-push-action@v2 - with: - platforms: linux/amd64,linux/arm64 - context: . - file: dockerfiles/Dockerfile - push: true - tags: | - ghcr.io/${{ github.repository }}:latest - - # Push `{VERSION}` when pushing a new tag - - name: Build and push - if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' - uses: docker/build-push-action@v2 - with: - platforms: linux/amd64,linux/arm64 - context: . - file: dockerfiles/Dockerfile - push: true - tags: | - ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.tag }} diff --git a/.github/workflows/deploy_mkdocs.yml b/.github/workflows/deploy_mkdocs.yml deleted file mode 100644 index fe804ac..0000000 --- a/.github/workflows/deploy_mkdocs.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Publish docs via GitHub Pages - -on: - push: - branches: - - master - paths: - # Only rebuild website when docs have changed - - 'README.md' - - 'CHANGES.md' - - 'CONTRIBUTING.md' - - 'docs/**' - -jobs: - build: - name: Deploy docs - runs-on: ubuntu-latest - steps: - - name: Checkout master - uses: actions/checkout@v3 - - - name: Set up Python 3.8 - uses: actions/setup-python@v4 - with: - python-version: 3.8 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -e .["docs"] - - - name: Create API docs - env: - # we need to set a fake PG url or import will fail - DATABASE_URL: postgresql://username:password@0.0.0.0:5439/postgis - run: | - pdocs as_markdown \ - --output_dir docs/src/api \ - --exclude_source \ - --overwrite \ - timvt.settings \ - timvt.layer \ - timvt.factory \ - timvt.dependencies \ - timvt.db \ - timvt.resources.enums \ - timvt.models.mapbox \ - timvt.models.OGC - - - name: Deploy docs - run: mkdocs gh-deploy --force -f docs/mkdocs.yml diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d9cde6c..0000000 --- a/.gitignore +++ /dev/null @@ -1,112 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# dotenv -.env - -# virtualenv -.venv -venv/ -ENV/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ - -cdk.out/ - -# pycharm -.idea/ - -docs/api - -benchmark/ - -.pgdata diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index e88fead..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,33 +0,0 @@ -repos: - - repo: https://github.com/psf/black - rev: 22.3.0 - hooks: - - id: black - language_version: python - - - repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort - language_version: python - - - repo: https://github.com/PyCQA/flake8 - rev: 3.8.3 - hooks: - - id: flake8 - language_version: python - - - repo: https://github.com/PyCQA/pydocstyle - rev: 6.1.1 - hooks: - - id: pydocstyle - language_version: python - additional_dependencies: - - toml - - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.991 - hooks: - - id: mypy - language_version: python - diff --git a/404.html b/404.html new file mode 100644 index 0000000..ee70d86 --- /dev/null +++ b/404.html @@ -0,0 +1,546 @@ + + + +
+ + + + + + + + + + + + + + + +
-
-
A lightweight PostGIS based dynamic vector tile server.
- - - - ---- - -**Documentation**: https://developmentseed.org/timvt/ - -**Source Code**: https://github.com/developmentseed/timvt - ---- - -> :warning: This project is on pause while we focus on [`developmentseed/tipg`](https://github.com/developmentseed/tipg) :warning: -> -> ref: https://github.com/developmentseed/timvt/discussions/96 - ---- - -`TiMVT`, pronounced **tee-MVT**, is a python package which helps creating lightweight [Vector Tiles](https://github.com/mapbox/vector-tile-spec) service from [PostGIS](https://github.com/postgis/postgis) Database. - -Built on top of the *modern and fast* [FastAPI](https://fastapi.tiangolo.com) framework, timvt is written in Python using async/await asynchronous code to improve the performances and handle heavy loads. - -`TiMVT` is mostly inspired from the awesome [urbica/martin](https://github.com/urbica/martin) and [CrunchyData/pg_tileserv](https://github.com/CrunchyData/pg_tileserv) projects. - -## Features - -- Multiple TileMatrixSets via [morecantile](https://github.com/developmentseed/morecantile). Default is set to WebMercatorQuad which is the usual Web Mercator projection used in most of Wep Map libraries.) -- Built with [FastAPI](https://fastapi.tiangolo.com) -- Table and Function layers -- Async API using [asyncpg](https://github.com/MagicStack/asyncpg) - - -## Install - -Install `TiMVT` from pypi -```bash -# update pip (optional) -python -m pip install pip -U - -# install timvt -python -m pip install timvt -``` - -or install from source: - -```bash -$ git clone https://github.com/developmentseed/timvt.git -$ cd timvt -$ python -m pip install -e . -``` - -## PostGIS/Postgres - -`TiMVT` rely mostly on [`ST_AsMVT`](https://postgis.net/docs/ST_AsMVT.html) function and will need PostGIS >= 2.5. - -If you want more info about `ST_AsMVT` function or on the subject of creating Vector Tile from PostGIS, please read this great article from Paul Ramsey: https://info.crunchydata.com/blog/dynamic-vector-tiles-from-postgis - -### Configuration - -To be able to create Vector Tile, the application will need access to the PostGIS database. `TiMVT` uses [pydantic](https://pydantic-docs.helpmanual.io/usage/settings/)'s configuration pattern which make use of environment variable and/or `.env` file to pass variable to the application. - -Example of `.env` file can be found in [.env.example](https://github.com/developmentseed/timvt/blob/master/.env.example) -``` -POSTGRES_USER=username -POSTGRES_PASS=password -POSTGRES_DBNAME=postgis -POSTGRES_HOST=0.0.0.0 -POSTGRES_PORT=5432 - -# Or you can also define the DATABASE_URL directly -DATABASE_URL=postgresql://username:password@0.0.0.0:5432/postgis -``` - -## Minimal Application - -```python -from timvt.db import close_db_connection, connect_to_db -from timvt.factory import VectorTilerFactory -from timvt.layer import FunctionRegistry -from fastapi import FastAPI, Request - -# Create Application. -app = FastAPI() - -# Add Function registry to the application state -app.state.timvt_function_catalog = FunctionRegistry() - -# Register Start/Stop application event handler to setup/stop the database connection -# and populate `app.state.table_catalog` -@app.on_event("startup") -async def startup_event(): - """Application startup: register the database connection and create table list.""" - await connect_to_db(app) - - -@app.on_event("shutdown") -async def shutdown_event(): - """Application shutdown: de-register the database connection.""" - await close_db_connection(app) - -# Register endpoints. -mvt_tiler = VectorTilerFactory( - with_tables_metadata=True, - with_functions_metadata=True, # add Functions metadata endpoints (/functions.json, /{function_name}.json) - with_viewer=True, -) -app.include_router(mvt_tiler.router, tags=["Tiles"]) -``` - -## Default Application - -While we encourage users to write their own application using `TiMVT` package, we also provide a default `production ready` application: - -```bash -# Install timvt dependencies and Uvicorn (a lightning-fast ASGI server) -$ pip install timvt 'uvicorn[standard]>=0.12.0,<0.14.0' - -# Set Database URL environment variable so TiMVT can access it -$ export DATABASE_URL=postgresql://username:password@0.0.0.0:5432/postgis - -# Launch Demo Application -$ uvicorn timvt.main:app --reload -``` - -You can also use the official docker image - -``` -$ docker run \ - -p 8081:8081 \ - -e PORT=8081 \ - -e DATABASE_URL=postgresql://username:password@0.0.0.0:5432/postgis \ - ghcr.io/developmentseed/timvt:latest -``` - -`:endpoint:/docs` - - - - -## Contribution & Development - -See [CONTRIBUTING.md](https://github.com/developmentseed/timvt/blob/master/CONTRIBUTING.md) - -## License - -See [LICENSE](https://github.com/developmentseed/timvt/blob/master/LICENSE) - -## Authors - -Created by [Development Seed](timvt.db: database events.
+def close_db_connection(
+ app: fastapi.applications.FastAPI
+) -> None
+
Close connection.
+def con_init(
+ conn
+)
+
Use json for json returns.
+def connect_to_db(
+ app: fastapi.applications.FastAPI,
+ settings: Union[timvt.settings.PostgresSettings, NoneType] = None,
+ **kwargs
+) -> None
+
Connect.
+def register_table_catalog(
+ app: fastapi.applications.FastAPI,
+ **kwargs: Any
+) -> None
+
Register Table catalog.
+ + + + + + + +TiVTiler.dependencies: endpoint's dependencies.
+def LayerParams(
+ request: starlette.requests.Request,
+ layer: str = Path(Ellipsis)
+) -> timvt.layer.Layer
+
Return Layer Object.
+def TileParams(
+ z: int = Path(Ellipsis),
+ x: int = Path(Ellipsis),
+ y: int = Path(Ellipsis)
+) -> morecantile.commons.Tile
+
Tile parameters.
+ + + + + + + +timvt.endpoints.factory: router factories.
+TILE_RESPONSE_PARAMS
+
templates
+
def queryparams_to_kwargs(
+ q: starlette.datastructures.QueryParams,
+ ignore_keys: List = []
+) -> Dict
+
Convert query params to dict.
+class TMSFactory(
+ supported_tms: morecantile.defaults.TileMatrixSets = TileMatrixSets(tms={'CanadianNAD83_LCC': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/CanadianNAD83_LCC.json'), 'EuropeanETRS89_LAEAQuad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/EuropeanETRS89_LAEAQuad.json'), 'LINZAntarticaMapTilegrid': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/LINZAntarticaMapTilegrid.json'), 'NZTM2000': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/NZTM2000.json'), 'NZTM2000Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/NZTM2000Quad.json'), 'UPSAntarcticWGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/UPSAntarcticWGS84Quad.json'), 'UPSArcticWGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/UPSArcticWGS84Quad.json'), 'UTM31WGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/UTM31WGS84Quad.json'), 'WGS1984Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/WGS1984Quad.json'), 'WebMercatorQuad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/WebMercatorQuad.json'), 'WorldCRS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/WorldCRS84Quad.json'), 'WorldMercatorWGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/WorldMercatorWGS84Quad.json')}),
+ router: fastapi.routing.APIRouter = <factory>,
+ router_prefix: str = ''
+)
+
TileMatrixSet endpoints Factory.
+router_prefix
+
supported_tms
+
def register_routes(
+ self
+)
+
Register TMS endpoint routes.
+def url_for(
+ self,
+ request: starlette.requests.Request,
+ name: str,
+ **path_params: Any
+) -> str
+
Return full url (with prefix) for a specific endpoint.
+class VectorTilerFactory(
+ router: fastapi.routing.APIRouter = <factory>,
+ supported_tms: morecantile.defaults.TileMatrixSets = TileMatrixSets(tms={'CanadianNAD83_LCC': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/CanadianNAD83_LCC.json'), 'EuropeanETRS89_LAEAQuad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/EuropeanETRS89_LAEAQuad.json'), 'LINZAntarticaMapTilegrid': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/LINZAntarticaMapTilegrid.json'), 'NZTM2000': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/NZTM2000.json'), 'NZTM2000Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/NZTM2000Quad.json'), 'UPSAntarcticWGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/UPSAntarcticWGS84Quad.json'), 'UPSArcticWGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/UPSArcticWGS84Quad.json'), 'UTM31WGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/UTM31WGS84Quad.json'), 'WGS1984Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/WGS1984Quad.json'), 'WebMercatorQuad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/WebMercatorQuad.json'), 'WorldCRS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/WorldCRS84Quad.json'), 'WorldMercatorWGS84Quad': PosixPath('/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/morecantile/data/WorldMercatorWGS84Quad.json')}),
+ default_tms: str = 'WebMercatorQuad',
+ layer_dependency: Callable[..., timvt.layer.Layer] = <function LayerParams at 0x7fb2f59d9280>,
+ with_tables_metadata: bool = False,
+ with_functions_metadata: bool = False,
+ with_viewer: bool = False,
+ router_prefix: str = ''
+)
+
VectorTiler Factory.
+default_tms
+
router_prefix
+
supported_tms
+
with_functions_metadata
+
with_tables_metadata
+
with_viewer
+
def layer_dependency(
+ request: starlette.requests.Request,
+ layer: str = Path(Ellipsis)
+) -> timvt.layer.Layer
+
Return Layer Object.
+def register_functions_metadata(
+ self
+)
+
Register function metadata endpoints.
+def register_routes(
+ self
+)
+
Register Routes.
+def register_tables_metadata(
+ self
+)
+
Register metadata endpoints.
+def register_tiles(
+ self
+)
+
Register /tiles endpoints.
+def register_viewer(
+ self
+)
+
Register viewer.
+def url_for(
+ self,
+ request: starlette.requests.Request,
+ name: str,
+ **path_params: Any
+) -> str
+
Return full url (with prefix) for a specific endpoint.
+ + + + + + + +timvt models.
+tile_settings
+
class Function(
+ __pydantic_self__,
+ **data: Any
+)
+
Function Reader.
+Name | +Type | +Description | +Default | +
---|---|---|---|
id | +str | +Layer's name. | +None | +
bounds | +list | +Layer's bounds (left, bottom, right, top). | +None | +
minzoom | +int | +Layer's min zoom level. | +None | +
maxzoom | +int | +Layer's max zoom level. | +None | +
tileurl | +str | +Layer's tiles url. | +None | +
type | +str | +Layer's type. | +None | +
function_name | +str | +Nane of the SQL function to call. Defaults to id . |
+id |
+
sql | +str | +Valid SQL function which returns Tile data. | +None | +
options | +list | +options available for the SQL function. | +None | +
Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_file(
+ id: str,
+ infile: str,
+ **kwargs: Any
+)
+
load sql from file
+def from_orm(
+ obj: Any
+) -> 'Model'
+
def function_name_default(
+ values
+)
+
Define default function's name to be same as id.
+def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def get_tile(
+ self,
+ pool: buildpg.asyncpg.BuildPgPool,
+ tile: morecantile.commons.Tile,
+ tms: morecantile.models.TileMatrixSet,
+ **kwargs: Any
+)
+
Get Tile Data.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
class FunctionRegistry(
+
+)
+
function registry
+funcs
+
def get(
+ key: str
+)
+
lookup function by name
+def register(
+ *args: timvt.layer.Function
+)
+
register function(s)
+def values(
+
+)
+
get all values.
+class Layer(
+ __pydantic_self__,
+ **data: Any
+)
+
Layer's Abstract BaseClass.
+Name | +Type | +Description | +Default | +
---|---|---|---|
id | +str | +Layer's name. | +None | +
bounds | +list | +Layer's bounds (left, bottom, right, top). | +None | +
minzoom | +int | +Layer's min zoom level. | +None | +
maxzoom | +int | +Layer's max zoom level. | +None | +
default_tms | +str | +TileMatrixSet name for the min/max zoom. | +None | +
tileurl | +str | +Layer's tiles url. | +None | +
Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def get_tile(
+ self,
+ pool: buildpg.asyncpg.BuildPgPool,
+ tile: morecantile.commons.Tile,
+ tms: morecantile.models.TileMatrixSet,
+ **kwargs: Any
+) -> bytes
+
Return Tile Data.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
pool | +asyncpg.BuildPgPool | +AsyncPG database connection pool. | +None | +
tile | +morecantile.Tile | +Tile object with X,Y,Z indices. | +None | +
tms | +morecantile.TileMatrixSet | +Tile Matrix Set. | +None | +
kwargs | +any, optiona | +Optional parameters to forward to the SQL function. | +None | +
Returns:
+Type | +Description | +
---|---|
bytes | +Mapbox Vector Tiles. | +
def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
class Table(
+ __pydantic_self__,
+ **data: Any
+)
+
Table Reader.
+Name | +Type | +Description | +Default | +
---|---|---|---|
id | +str | +Layer's name. | +None | +
bounds | +list | +Layer's bounds (left, bottom, right, top). | +None | +
minzoom | +int | +Layer's min zoom level. | +None | +
maxzoom | +int | +Layer's max zoom level. | +None | +
tileurl | +str | +Layer's tiles url. | +None | +
type | +str | +Layer's type. | +None | +
table | +str | +Table's name. | +None | +
schema | +str | +Table's database schema (e.g public). | +None | +
description | +str | +Table's description. | +None | +
id_column | +str | +name of id column | +None | +
geometry_columns | +list | +List of geometry columns. | +None | +
properties | +list | +List of property columns. | +None | +
Config
+
def bounds_default(
+ values
+)
+
Get default bounds from the first geometry columns.
+def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
id_column_info
+
Return Column for a unique identifier.
+def columns(
+ self,
+ properties: Union[List[str], NoneType] = None
+) -> List[str]
+
Return table columns optionally filtered to only include columns from properties.
+def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def get_column(
+ self,
+ property_name: str
+) -> Union[timvt.dbmodel.Column, NoneType]
+
Return column info.
+def get_datetime_column(
+ self,
+ name: Union[str, NoneType] = None
+) -> Union[timvt.dbmodel.Column, NoneType]
+
Return the Column for either the passed in tstz column or the first tstz column.
+def get_geometry_column(
+ self,
+ name: Union[str, NoneType] = None
+) -> Union[timvt.dbmodel.GeometryColumn, NoneType]
+
Return the name of the first geometry column.
+def get_tile(
+ self,
+ pool: buildpg.asyncpg.BuildPgPool,
+ tile: morecantile.commons.Tile,
+ tms: morecantile.models.TileMatrixSet,
+ **kwargs: Any
+)
+
Get Tile Data.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
timvt.models.OGC: Open GeoSpatial Consortium models.
+class TileMatrixSetLink(
+ __pydantic_self__,
+ **data: Any
+)
+
TileMatrixSetLink model.
+Based on docs.opengeospatial.org/per/19-069.html#_tilematrixsets
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
class TileMatrixSetList(
+ __pydantic_self__,
+ **data: Any
+)
+
TileMatrixSetList model.
+Based on docs.opengeospatial.org/per/19-069.html#_tilematrixsets
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
class TileMatrixSetRef(
+ __pydantic_self__,
+ **data: Any
+)
+
TileMatrixSetRef model.
+Based on docs.opengeospatial.org/per/19-069.html#_tilematrixsets
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
Tilejson response models.
+class SchemeEnum(
+ /,
+ *args,
+ **kwargs
+)
+
TileJSON scheme choice.
+name
+
tms
+
value
+
xyz
+
class TileJSON(
+ __pydantic_self__,
+ **data: Any
+)
+
TileJSON model.
+Based on github.com/mapbox/tilejson-spec/tree/master/2.2.0
+Config
+
def compute_center(
+ values
+)
+
Compute center if it does not exist.
+def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
timvt.resources.enums.
+class MimeTypes(
+ /,
+ *args,
+ **kwargs
+)
+
Responses MineTypes.
+geojson
+
html
+
json
+
mvt
+
name
+
pbf
+
text
+
value
+
xml
+
class VectorType(
+ /,
+ *args,
+ **kwargs
+)
+
Vector Type Enums.
+mvt
+
name
+
pbf
+
value
+
TiMVT config.
+TiMVT uses pydantic.BaseSettings to either get settings from .env
or environment variables
+see: pydantic-docs.helpmanual.io/usage/settings/
def ApiSettings(
+
+) -> timvt.settings._ApiSettings
+
This function returns a cached instance of the APISettings object.
+Caching is used to prevent re-reading the environment every time the API settings are used in an endpoint.
+If you want to change an environment variable and reset the cache (e.g., during testing), this can be done
+using the lru_cache
instance method get_api_settings.cache_clear()
.
def TileSettings(
+
+) -> timvt.settings._TileSettings
+
Cache settings.
+class PostgresSettings(
+ __pydantic_self__,
+ _env_file: Union[str, os.PathLike, List[Union[str, os.PathLike]], Tuple[Union[str, os.PathLike], ...], NoneType] = '<object object at 0x7fb2f76417f0>',
+ _env_file_encoding: Union[str, NoneType] = None,
+ _env_nested_delimiter: Union[str, NoneType] = None,
+ _secrets_dir: Union[str, os.PathLike, NoneType] = None,
+ **values: Any
+)
+
Postgres-specific API settings.
+Name | +Type | +Description | +Default | +
---|---|---|---|
postgres_user | +None | +postgres username. | +None | +
postgres_pass | +None | +postgres password. | +None | +
postgres_host | +None | +hostname for the connection. | +None | +
postgres_port | +None | +database port. | +None | +
postgres_dbname | +None | +database name. | +None | +
Config
+
def assemble_db_connection(
+ v: Union[str, NoneType],
+ values: Dict[str, Any]
+) -> Any
+
Validate database config.
+def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
class TableConfig(
+ /,
+ *args,
+ **kwargs
+)
+
Configuration to add table options with env variables.
+def clear(
+ ...
+)
+
D.clear() -> None. Remove all items from D.
+def copy(
+ ...
+)
+
D.copy() -> a shallow copy of D
+def fromkeys(
+ iterable,
+ value=None,
+ /
+)
+
Create a new dictionary with keys from iterable and values set to value.
+def get(
+ self,
+ key,
+ default=None,
+ /
+)
+
Return the value for key if key is in the dictionary, else default.
+def items(
+ ...
+)
+
D.items() -> a set-like object providing a view on D's items
+def keys(
+ ...
+)
+
D.keys() -> a set-like object providing a view on D's keys
+def pop(
+ ...
+)
+
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
+If key is not found, d is returned if given, otherwise KeyError is raised
+def popitem(
+ self,
+ /
+)
+
Remove and return a (key, value) pair as a 2-tuple.
+Pairs are returned in LIFO (last-in, first-out) order. +Raises KeyError if the dict is empty.
+def setdefault(
+ self,
+ key,
+ default=None,
+ /
+)
+
Insert key with a value of default if key is not in the dictionary.
+Return the value for key if key is in the dictionary, else default.
+def update(
+ ...
+)
+
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
+If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] +If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v +In either case, this is followed by: for k in F: D[k] = F[k]
+def values(
+ ...
+)
+
D.values() -> an object providing a view on D's values
+class TableSettings(
+ __pydantic_self__,
+ _env_file: Union[str, os.PathLike, List[Union[str, os.PathLike]], Tuple[Union[str, os.PathLike], ...], NoneType] = '<object object at 0x7fb2f76417f0>',
+ _env_file_encoding: Union[str, NoneType] = None,
+ _env_nested_delimiter: Union[str, NoneType] = None,
+ _secrets_dir: Union[str, os.PathLike, NoneType] = None,
+ **values: Any
+)
+
Table configuration settings
+Config
+
def construct(
+ _fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
+ **values: Any
+) -> 'Model'
+
Creates a new model setting dict and fields_set from trusted or pre-validated data.
+Default values are respected, but no other validation is performed.
+Behaves as if Config.extra = 'allow'
was set since it adds all passed values
def from_orm(
+ obj: Any
+) -> 'Model'
+
def parse_file(
+ path: Union[str, pathlib.Path],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def parse_obj(
+ obj: Any
+) -> 'Model'
+
def parse_raw(
+ b: Union[str, bytes],
+ *,
+ content_type: 'unicode' = None,
+ encoding: 'unicode' = 'utf8',
+ proto: pydantic.parse.Protocol = None,
+ allow_pickle: bool = False
+) -> 'Model'
+
def schema(
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}'
+) -> 'DictStrAny'
+
def schema_json(
+ *,
+ by_alias: bool = True,
+ ref_template: 'unicode' = '#/definitions/{model}',
+ **dumps_kwargs: Any
+) -> 'unicode'
+
def update_forward_refs(
+ **localns: Any
+) -> None
+
Try to update ForwardRefs on fields based on this Model, globalns and localns.
+def validate(
+ value: Any
+) -> 'Model'
+
def copy(
+ self: 'Model',
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ update: Union[ForwardRef('DictStrAny'), NoneType] = None,
+ deep: bool = False
+) -> 'Model'
+
Duplicate a model, optionally choose which fields to include, exclude and change.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
include | +None | +fields to include in new model | +None | +
exclude | +None | +fields to exclude from new model, as with values this takes precedence over include | +None | +
update | +None | +values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
+None | +
deep | +None | +set to True to make a deep copy of the model |
+None | +
Returns:
+Type | +Description | +
---|---|
None | +new model instance | +
def dict(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False
+) -> 'DictStrAny'
+
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
+def json(
+ self,
+ *,
+ include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
+ by_alias: bool = False,
+ skip_defaults: Union[bool, NoneType] = None,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ encoder: Union[Callable[[Any], Any], NoneType] = None,
+ models_as_dict: bool = True,
+ **dumps_kwargs: Any
+) -> 'unicode'
+
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
Issues and pull requests are more than welcome: github.com/developmentseed/timvt/issues
+dev install
+$ git clone https://github.com/developmentseed/timvt.git
+$ cd timvt
+$ pip install -e .["test,dev"]
+
You can then run the tests with the following command:
+python -m pytest --cov timvt --cov-report term-missing
+
pre-commit
+This repo is set to use pre-commit
to run isort, flake8, pydocstring, black ("uncompromising Python code formatter") and mypy when committing new code.
$ pre-commit install
+
$ git clone https://github.com/developmentseed/timvt.git
+$ cd timvt
+$ pip install -e .["docs"]
+
Hot-reloading docs:
+$ mkdocs serve
+
To manually deploy docs (note you should never need to do this because Github +Actions deploys automatically for new commits.):
+$ mkdocs gh-deploy
+