Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Note: Minor version `0.X.0` update might break the API, It's recommended to pin

## [unreleased]

* fix geometry simplification on OGC Tiles endpoints (author @guillemc23, https://github.com/developmentseed/tipg/pull/249)
Comment thread
guillemc23 marked this conversation as resolved.
Outdated


## [1.3.0] - 2025-11-17

* switch to official python docker image from `bitnami`
Expand Down
9 changes: 9 additions & 0 deletions tipg/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,13 @@ def _select_mvt(
"""Create MVT from intersecting geometries."""
geom = pg_funcs.cast(logic.V(geometry_column.name), "geometry")

if simplify:
Comment thread
guillemc23 marked this conversation as resolved.
geom = logic.Func(
"ST_Simplify",
geom,
simplify
)

# make sure the geometries do not overflow the TMS bbox
if not tms.is_valid(tile):
geom = logic.Func(
Expand Down Expand Up @@ -866,6 +873,7 @@ async def get_tile(
geom: Optional[str] = None,
dt: Optional[str] = None,
limit: Optional[int] = None,
simplify: Optional[float] = None,
):
"""Build query to get Vector Tile."""
limit = limit or mvt_settings.max_features_per_tile
Expand All @@ -885,6 +893,7 @@ async def get_tile(
geometry_column=geometry_column,
tms=tms,
tile=tile,
simplify=simplify,
),
self._from(function_parameters),
self._where(
Expand Down
7 changes: 7 additions & 0 deletions tipg/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1668,6 +1668,12 @@ async def collection_get_tile(
description="Limits the number of features in the response. Defaults to 10000 or TIPG_MAX_FEATURES_PER_TILE environment variable."
),
] = None,
simplify: Annotated[
Optional[float],
Query(
description="Simplify the output geometry to given threshold in decimal degrees.",
),
] = None,
):
"""Return Vector Tile."""
tms = self.supported_tms.get(tileMatrixSetId)
Expand All @@ -1688,6 +1694,7 @@ async def collection_get_tile(
limit=limit,
geom=geom_column,
dt=datetime_column,
simplify=simplify
)

return Response(tile, media_type=MediaType.mvt.value)
Expand Down
Loading