{"id":23113737,"url":"https://github.com/developmentseed/timvt","last_synced_at":"2025-04-05T12:09:11.161Z","repository":{"id":37801827,"uuid":"263787865","full_name":"developmentseed/timvt","owner":"developmentseed","description":"PostGIS based Vector Tile server.","archived":false,"fork":false,"pushed_at":"2024-07-11T04:17:24.000Z","size":10690,"stargazers_count":192,"open_issues_count":9,"forks_count":27,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-29T11:09:37.162Z","etag":null,"topics":["asyncio","fastapi","postgis","postgresql","python","tile-server","vector","vector-tile-server","vector-tiles"],"latest_commit_sha":null,"homepage":"https://developmentseed.org/timvt/","language":"PLpgSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/developmentseed.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-14T01:47:51.000Z","updated_at":"2025-03-24T19:13:50.000Z","dependencies_parsed_at":"2024-01-07T00:53:25.839Z","dependency_job_id":"d2276707-7fa9-4b19-9f83-d194ac7080c8","html_url":"https://github.com/developmentseed/timvt","commit_stats":{"total_commits":190,"total_committers":5,"mean_commits":38.0,"dds":"0.17368421052631577","last_synced_commit":"b1c6f6158a05708365fb68f037b53481cffe9383"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Ftimvt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Ftimvt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Ftimvt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Ftimvt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developmentseed","download_url":"https://codeload.github.com/developmentseed/timvt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332612,"owners_count":20921853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","fastapi","postgis","postgresql","python","tile-server","vector","vector-tile-server","vector-tiles"],"created_at":"2024-12-17T03:13:32.582Z","updated_at":"2025-04-05T12:09:11.135Z","avatar_url":"https://github.com/developmentseed.png","language":"PLpgSQL","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"500\" src=\"https://user-images.githubusercontent.com/10407788/172734314-a2b47e51-b919-4aa3-a7cf-33e57f3c2852.png\"/\u003e\n  \u003cp align=\"center\"\u003eA lightweight PostGIS based dynamic vector tile server.\u003c/p\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/developmentseed/timvt/actions?query=workflow%3ACI\" target=\"_blank\"\u003e\n      \u003cimg src=\"https://github.com/developmentseed/timvt/workflows/CI/badge.svg\" alt=\"Test\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/developmentseed/timvt\" target=\"_blank\"\u003e\n      \u003cimg src=\"https://codecov.io/gh/developmentseed/timvt/branch/master/graph/badge.svg\" alt=\"Coverage\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pypi.org/project/timvt\" target=\"_blank\"\u003e\n      \u003cimg src=\"https://img.shields.io/pypi/v/timvt?color=%2334D058\u0026label=pypi%20package\" alt=\"Package version\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/developmentseed/timvt/blob/master/LICENSE\" target=\"_blank\"\u003e\n      \u003cimg src=\"https://img.shields.io/github/license/developmentseed/timvt.svg\" alt=\"License\"\u003e\n\n  \u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n**Documentation**: \u003ca href=\"https://developmentseed.org/timvt/\" target=\"_blank\"\u003ehttps://developmentseed.org/timvt/\u003c/a\u003e\n\n**Source Code**: \u003ca href=\"https://github.com/developmentseed/timvt\" target=\"_blank\"\u003ehttps://github.com/developmentseed/timvt\u003c/a\u003e\n\n---\n\n\u003e :warning: This project is on pause while we focus on [`developmentseed/tipg`](https://github.com/developmentseed/tipg) :warning:\n\u003e\n\u003e  ref: https://github.com/developmentseed/timvt/discussions/96\n\n---\n\n`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.\n\nBuilt 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.\n\n`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.\n\n## Features\n\n- 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.)\n- Built with [FastAPI](https://fastapi.tiangolo.com)\n- Table and Function layers\n- Async API using [asyncpg](https://github.com/MagicStack/asyncpg)\n\n\n## Install\n\nInstall `TiMVT` from pypi\n```bash\n# update pip (optional)\npython -m pip install pip -U\n\n# install timvt\npython -m pip install timvt\n```\n\nor install from source:\n\n```bash\n$ git clone https://github.com/developmentseed/timvt.git\n$ cd timvt\n$ python -m pip install -e .\n```\n\n## PostGIS/Postgres\n\n`TiMVT` rely mostly on [`ST_AsMVT`](https://postgis.net/docs/ST_AsMVT.html) function and will need PostGIS \u003e= 2.5.\n\nIf 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\n\n### Configuration\n\nTo 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.\n\nExample of `.env` file can be found in [.env.example](https://github.com/developmentseed/timvt/blob/master/.env.example)\n```\nPOSTGRES_USER=username\nPOSTGRES_PASS=password\nPOSTGRES_DBNAME=postgis\nPOSTGRES_HOST=0.0.0.0\nPOSTGRES_PORT=5432\n\n# Or you can also define the DATABASE_URL directly\nDATABASE_URL=postgresql://username:password@0.0.0.0:5432/postgis\n```\n\n## Minimal Application\n\n```python\nfrom timvt.db import close_db_connection, connect_to_db\nfrom timvt.factory import VectorTilerFactory\nfrom timvt.layer import FunctionRegistry\nfrom fastapi import FastAPI, Request\n\n# Create Application.\napp = FastAPI()\n\n# Add Function registry to the application state\napp.state.timvt_function_catalog = FunctionRegistry()\n\n# Register Start/Stop application event handler to setup/stop the database connection\n# and populate `app.state.table_catalog`\n@app.on_event(\"startup\")\nasync def startup_event():\n    \"\"\"Application startup: register the database connection and create table list.\"\"\"\n    await connect_to_db(app)\n\n\n@app.on_event(\"shutdown\")\nasync def shutdown_event():\n    \"\"\"Application shutdown: de-register the database connection.\"\"\"\n    await close_db_connection(app)\n\n# Register endpoints.\nmvt_tiler = VectorTilerFactory(\n    with_tables_metadata=True,\n    with_functions_metadata=True,  # add Functions metadata endpoints (/functions.json, /{function_name}.json)\n    with_viewer=True,\n)\napp.include_router(mvt_tiler.router, tags=[\"Tiles\"])\n```\n\n## Default Application\n\nWhile we encourage users to write their own application using `TiMVT` package, we also provide a default `production ready` application:\n\n```bash\n# Install timvt dependencies and Uvicorn (a lightning-fast ASGI server)\n$ pip install timvt 'uvicorn[standard]\u003e=0.12.0,\u003c0.14.0'\n\n# Set Database URL environment variable so TiMVT can access it\n$ export DATABASE_URL=postgresql://username:password@0.0.0.0:5432/postgis\n\n# Launch Demo Application\n$ uvicorn timvt.main:app --reload\n```\n\nYou can also use the official docker image\n\n```\n$ docker run \\\n    -p 8081:8081 \\\n    -e PORT=8081 \\\n    -e DATABASE_URL=postgresql://username:password@0.0.0.0:5432/postgis \\\n    ghcr.io/developmentseed/timvt:latest\n```\n\n`:endpoint:/docs`\n\n![](https://user-images.githubusercontent.com/10407788/202146065-2ddcf159-123c-48f9-a208-7dcd46201cb4.png)\n\n\n## Contribution \u0026 Development\n\nSee [CONTRIBUTING.md](https://github.com/developmentseed/timvt/blob/master/CONTRIBUTING.md)\n\n## License\n\nSee [LICENSE](https://github.com/developmentseed/timvt/blob/master/LICENSE)\n\n## Authors\n\nCreated by [Development Seed](\u003chttp://developmentseed.org\u003e)\n\n## Changes\n\nSee [CHANGES.md](https://github.com/developmentseed/timvt/blob/master/CHANGES.md).\n\n","funding_links":[],"categories":["Servers"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopmentseed%2Ftimvt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevelopmentseed%2Ftimvt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopmentseed%2Ftimvt/lists"}