collections
tipg.collections ¶
tipg.dbmodel: database events.
Collection ¶
Bases: BaseModel
Collection Base Class.
dt_bounds
cached
property
¶
Return temporal bounds from collection extent.
_reproject_geometry_literal
abstractmethod
¶
Reproject a EPSG:4326 cql2-json geometry literal to srid
(returns a cql2-json function call node).
_tag_geometry_literal
abstractmethod
¶
Tag a cql2-json geometry literal, whose coordinates are already in
srid, with that CRS (returns a cql2-json function call node).
columns ¶
Return table columns optionally filtered to only include columns from properties.
cql_where ¶
cql_where(
ids: list[str] | None = None,
datetime: list[str] | None = None,
bbox: list[float] | None = None,
properties: list[tuple[str, Any]] | None = None,
cql: Expr | None = None,
geom: str | None = None,
dt: str | None = None,
tile: Tile | None = None,
tms: TileMatrixSet | None = None,
) -> Expr | None
Construct WHERE query as a cql2 Expr.
get_datetime_column ¶
Return the Column for either the passed in tstz column or the first tstz column.
get_geometry_column ¶
Return the name of the first geometry column.
Column ¶
_coerce_id ¶
Parse a URL-supplied id into the primary-key column's Python type.
IDs always arrive as strings (URL path or query parameters); the
underlying column is either text or integer. cql2 treats Python ints
and strs as different literal kinds (and PostgreSQL = ANY(text[])
does not coerce array elements at runtime), so we normalize here.
A non-integer string against an integer column means the id can't
exist, so map the parse failure onto a 404 rather than letting the
eventual PostgreSQL invalid input syntax error bubble up as a 500.
_s_intersects_bbox ¶
_s_intersects_bbox(
prop: str,
west: float,
south: float,
east: float,
north: float,
srid: int | None = None,
*,
tag: GeometryLiteralWrapper
) -> Expr
Build a cql2 S_INTERSECTS expression against a polygon envelope.
Coordinates are taken to be in srid; if srid is non-4326, the
polygon literal is wrapped with tag (e.g PostGIS ST_SetSRID) so
the database does not pick up ST_GeomFromGeoJSON's 4326 default.
Pass srid=None or srid=4326 for the no-op case.
_transform_cql_geom_literals ¶
Walk a user-supplied cql2-json tree and wrap every GeoJSON geometry
literal with reproject (e.g PostGIS ST_Transform(<literal>, target_srid)).
Per OGC API Features Part 3 Req 7, geometries in a CQL filter are CRS84 (≈ EPSG:4326). Wrapping the literal side (rather than the column side) keeps PostGIS' spatial index on the column usable and lets the planner fold the transform on the constant once.