All Projects → developmentseed → timvt

developmentseed / timvt

Licence: MIT license
PostGIS based Vector Tile server.

Programming Languages

PLpgSQL
1095 projects

Projects that are alternatives of or similar to timvt

postile
Project migrated to: https://gitlab.com/Oslandia/postile
Stars: ✭ 67 (-40.71%)
Mutual labels:  vector-tiles, vector, postgis
fastapi-sqlalchemy-1.4-async
https://rogulski.it/blog/sqlalchemy-14-async-orm-with-fastapi/
Stars: ✭ 17 (-84.96%)
Mutual labels:  asyncio, fastapi
fastapi-boilerplate
FastAPI boilerplate for real world production
Stars: ✭ 145 (+28.32%)
Mutual labels:  asyncio, fastapi
cloud-tileserver
Serve mapbox vectortiles via AWS stack
Stars: ✭ 48 (-57.52%)
Mutual labels:  vector-tiles, postgis
HibiAPI
一个实现了多种常用站点的易用化API的程序 / A program that implements easy-to-use APIs for a variety of commonly used sites.
Stars: ✭ 427 (+277.88%)
Mutual labels:  asyncio, fastapi
fast-api-sqlalchemy-template
Dockerized web application on FastAPI, sqlalchemy1.4, PostgreSQL
Stars: ✭ 25 (-77.88%)
Mutual labels:  asyncio, fastapi
Fastapi
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Stars: ✭ 39,588 (+34933.63%)
Mutual labels:  asyncio, fastapi
hypercorn-fastapi-docker
Docker image with Hypercorn for FastAPI apps in Python 3.7, 3.8, 3.9. Ready for HTTP2 and HTTPS
Stars: ✭ 18 (-84.07%)
Mutual labels:  asyncio, fastapi
tilelive-postgis
Implements the tilelive API for generating vector tiles from PostGIS
Stars: ✭ 48 (-57.52%)
Mutual labels:  vector-tiles, postgis
Martin
Blazing fast and lightweight PostGIS vector tiles server
Stars: ✭ 540 (+377.88%)
Mutual labels:  vector-tiles, postgis
Tegola
Tegola is a Mapbox Vector Tile server written in Go
Stars: ✭ 754 (+567.26%)
Mutual labels:  vector-tiles, postgis
fastapi-framework
A FastAPI Framework for things like Database, Redis, Logging, JWT Authentication, Rate Limits and Sessions
Stars: ✭ 26 (-76.99%)
Mutual labels:  asyncio, fastapi
fastapi-azure-auth
Easy and secure implementation of Azure AD for your FastAPI APIs 🔒 B2C, single- and multi-tenant support.
Stars: ✭ 174 (+53.98%)
Mutual labels:  asyncio, fastapi
fastapi-users
Ready-to-use and customizable users management for FastAPI
Stars: ✭ 1,920 (+1599.12%)
Mutual labels:  asyncio, fastapi
fastapi-etag
Convenience library for working with etags in fastapi
Stars: ✭ 19 (-83.19%)
Mutual labels:  asyncio, fastapi
Baremaps
Custom vector tiles from OpenStreetMap and other data sources.
Stars: ✭ 100 (-11.5%)
Mutual labels:  vector-tiles, postgis
Djangorestframework Mvt
Serve Mapbox Vector Tiles with Django and Postgres
Stars: ✭ 33 (-70.8%)
Mutual labels:  vector-tiles, postgis
tilekiln
No description or website provided.
Stars: ✭ 3 (-97.35%)
Mutual labels:  vector-tiles, postgis
bety
Web-interface to the Biofuel Ecophysiological Traits and Yields Database (used by PEcAn and TERRA REF)
Stars: ✭ 14 (-87.61%)
Mutual labels:  postgis
aiotinydb
asyncio compatibility shim for tinydb
Stars: ✭ 42 (-62.83%)
Mutual labels:  asyncio

A lightweight PostGIS based dynamic vector tile server.

Test Coverage Package version License


Documentation: https://developmentseed.org/timvt/

Source Code: https://github.com/developmentseed/timvt


TiMVT, pronounced tee-MVT, is a python package which helps creating lightweight Vector Tiles service from PostGIS Database.

Built on top of the modern and fast FastAPI 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 and CrunchyData/pg_tileserv projects.

Features

  • Multiple TileMatrixSets via morecantile. Default is set to WebMercatorQuad which is the usual Web Mercator projection used in most of Wep Map libraries.)
  • Built with FastAPI
  • Table and Function layers
  • Async API using asyncpg

Install

Install TiMVT from pypi

# update pip (optional)
python -m pip install pip -U

# install timvt
python -m pip install timvt

or install from source:

$ git clone https://github.com/developmentseed/timvt.git
$ cd timvt
$ python -m pip install -e .

PostGIS/Postgres

TiMVT rely mostly on ST_AsMVT 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'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

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:[email protected]:5432/postgis

Minimal Application

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:

# 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:[email protected]: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:[email protected]:5432/postgis \
    ghcr.io/developmentseed/timvt:latest

:endpoint:/docs

Contribution & Development

See CONTRIBUTING.md

License

See LICENSE

Authors

Created by Development Seed

Changes

See CHANGES.md.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].