Vector Tiles in EPSG:2056 #165
Replies: 2 comments 26 replies
-
Hi @FabianRechsteiner In Line 1845 in 80a86a9 You have multiple choice for customization, but first you'll need to create a TileMatrixSet JSON document following the specs found in the geoserver docs (https://ogc.heig-vd.ch/geoserver/ogc/tiles/tileMatrixSets/EPSG%3A2056?f=application%2Fjson should work) Then you need to tell the endpoints that your TMS is available:
If you place you json file in a directory and then set or
This will require more work but also enable more customization from contextlib import asynccontextmanager
from typing import Any, List
import jinja2
from tipg.collections import register_collection_catalog
from tipg.database import close_db_connection, connect_to_db
from tipg.errors import DEFAULT_STATUS_CODES, add_exception_handlers
from tipg.factory import Endpoints
from tipg.middleware import CacheControlMiddleware, CatalogUpdateMiddleware
from tipg.settings import (
APISettings,
CustomSQLSettings,
DatabaseSettings,
PostgresSettings,
)
from fastapi import FastAPI, Request
from starlette.middleware.cors import CORSMiddleware
from starlette.templating import Jinja2Templates
from starlette_cramjam.middleware import CompressionMiddleware
import morecantile
settings = APISettings()
postgres_settings = PostgresSettings()
db_settings = DatabaseSettings()
custom_sql_settings = CustomSQLSettings()
default_tms = morecantile.tms.register({"MyCustomTmsEPSG2056": "path to the TMS file"})
@asynccontextmanager
async def lifespan(app: FastAPI):
"""FastAPI Lifespan."""
# Create Connection Pool
await connect_to_db(
app,
settings=postgres_settings,
schemas=db_settings.schemas,
user_sql_files=custom_sql_settings.sql_files,
)
# Register Collection Catalog
await register_collection_catalog(
app,
schemas=db_settings.schemas,
tables=db_settings.tables,
exclude_tables=db_settings.exclude_tables,
exclude_table_schemas=db_settings.exclude_table_schemas,
functions=db_settings.functions,
exclude_functions=db_settings.exclude_functions,
exclude_function_schemas=db_settings.exclude_function_schemas,
spatial=db_settings.only_spatial_tables,
spatial_extent=db_settings.spatial_extent,
datetime_extent=db_settings.datetime_extent,
)
yield
# Close the Connection Pool
await close_db_connection(app)
app = FastAPI(
title=settings.name,
openapi_url="/api",
docs_url="/api.html",
lifespan=lifespan,
)
ogc_api = Endpoints(
title=settings.name,
supported_tms=default_tms,
with_tiles_viewer=settings.add_tiles_viewer,
)
app.include_router(ogc_api.router)
app.add_middleware(CacheControlMiddleware, cachecontrol=settings.cachecontrol)
app.add_middleware(CompressionMiddleware)
add_exception_handlers(app, DEFAULT_STATUS_CODES) |
Beta Was this translation helpful? Give feedback.
-
Just FYI, last year we were able to run a service providing VT in CRS:2056 with t-rex https://github.com/t-rex-tileserver/t-rex. PS: the example are based on resolutions available in wmts.geo.admin.ch (2056) which are non exactly those of SwissLV95CellSizes |
Beta Was this translation helpful? Give feedback.
-
I would like to make my geospatial data available as Vector Tiles in the national coordinate system of Switzerland, EPSG:2056. Is it possible to support this as well?
Example: Geoserver
Beta Was this translation helpful? Give feedback.
All reactions