Skip to content

Commit 0b89b3b

Browse files
committed
more docs
1 parent 2ae5759 commit 0b89b3b

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
---
2525

26+
`TiFeatures`, pronounced **tee-Features**, is a python package which helps creating lightweight **Features** server for PostGIS Database. The API has been designed with respect to [OGC Features API specification](https://github.com/opengeospatial/ogcapi-features).
27+
2628
## Install
2729

2830
```bash
@@ -62,6 +64,12 @@ Part 1: Core | ✅ | https://docs.ogc.org/is/17-069r4/17-069r4.html
6264
Part 2: CRS by Reference | ❌ | https://docs.ogc.org/is/18-058r1/18-058r1.html
6365
Part 3: Filtering / CQL2 | ✅ | https://docs.ogc.org/DRAFTS/19-079r1.html
6466

67+
Notes:
68+
69+
The project authors choose not to implement the Part 2 of the specification to avoid the introduction of CRS based GeoJSON. This might change in the future.
70+
71+
While the authors tried to follow the specification (part 1 and 3) to the letter, some API endpoints might have more capacities (e.g geometry column selection).
72+
6573
## Contribution & Development
6674

6775
See [CONTRIBUTING.md](https://github.com/developmentseed/tifeatures/blob/master/CONTRIBUTING.md)

docs/mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ nav:
2020
- TiFeatures: "index.md"
2121
- Tutorial - User Guide:
2222
- "Endpoints": endpoints.md
23+
- Advanced User Guide:
24+
- "Combine MVT and Features": advanced/timvt_and_tifeatures.md
2325
- API:
2426
- db: api/tifeatures/db.md
2527
- dbmodel: api/tifeatures/dbmodel.md
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
3+
`TiFeatures` and [`TiMVT`](https://github.com/developmentseed/timvt) share a lot of in common and it's possible to create a unique FastAPI application with both **Features** and **MVT** endpoints:
4+
5+
```python
6+
"""Features and MVT app."""
7+
8+
from tifeatures.db import close_db_connection, connect_to_db, register_table_catalog
9+
from tifeatures.factory import Endpoints
10+
from timvt.factory import VectorTilerFactory
11+
from fastapi import FastAPI
12+
from starlette_cramjam.middleware import CompressionMiddleware
13+
14+
app = FastAPI(
15+
title="Features and MVT",
16+
openapi_url="/api",
17+
docs_url="/api.html",
18+
)
19+
20+
# Register endpoints.
21+
endpoints = Endpoints()
22+
app.include_router(endpoints.router, tags=["Features"])
23+
24+
# By default the VectorTilerFactory will only create tiles/ and tilejson.json endpoints
25+
mvt_endpoints = VectorTilerFactory()
26+
app.include_router(mvt_endpoints.router)
27+
28+
app.add_middleware(CompressionMiddleware)
29+
30+
31+
@app.on_event("startup")
32+
async def startup_event() -> None:
33+
"""Connect to database on startup."""
34+
await connect_to_db(app)
35+
# TiMVT and TiFeatures share the same `Table_catalog` format
36+
# see https://github.com/developmentseed/timvt/pull/83
37+
await register_table_catalog(app)
38+
39+
40+
@app.on_event("shutdown")
41+
async def shutdown_event() -> None:
42+
"""Close database connection."""
43+
await close_db_connection(app)
44+
```
45+
46+
!!! Note
47+
To run the example, copy the code to a file main.py, and start uvicorn with:
48+
49+
`uvicorn main:app --reload`
50+
51+
52+
![](https://user-images.githubusercontent.com/10407788/175392407-d8cf4fec-497c-42a7-ae8f-d754962bf1e7.png)

0 commit comments

Comments
 (0)