PostGIS¶
PostGIS explains exact and computational transport.
EwkbGeometry
¶
EwkbGeometry(
wkb: Buffer | EwkbGeometry | EwkbGeography, /, *, srid: int | None = None
)
A PostGIS geometry value as stored, in extended well-known binary (EWKB).
Results use this carrier for geometry columns under
Decoding(geometry='exact'), and it binds only to geometry
parameters and columns. Reading or binding it needs neither gometry nor
access to spatial_ref_sys. Construction checks the binary structure but
does not interpret coordinates. Values compare and hash by their bytes,
pickle, and export a read-only buffer.
Every PostGIS geometry kind is accepted, including curves and polyhedral surfaces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wkb
|
Buffer | EwkbGeometry | EwkbGeography
|
EWKB or ISO WKB bytes, any byte buffer, or another carrier. |
required |
srid
|
int | None
|
SRID to record when |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The bytes are not a well-formed PostGIS value, nested
parts carry different SRIDs, or |
geometry_type
property
¶
geometry_type: str
The PostGIS shape kind, such as 'Point' or 'CircularString'.
EwkbGeography
¶
EwkbGeography(
wkb: Buffer | EwkbGeometry | EwkbGeography, /, *, srid: int | None = None
)
A PostGIS geography value as stored, in extended well-known binary (EWKB).
Results use this carrier for geography columns under
Decoding(geometry='exact'), and it binds only to geography
parameters and columns. Reading or binding it needs neither gometry nor
access to spatial_ref_sys. Construction checks the binary structure but
does not interpret coordinates. Values compare and hash by their bytes,
pickle, and export a read-only buffer.
Kinds that PostGIS geography does not support, such as curves, are rejected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wkb
|
Buffer | EwkbGeometry | EwkbGeography
|
EWKB or ISO WKB bytes, any byte buffer, or another carrier. |
required |
srid
|
int | None
|
SRID to record when |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The bytes are not a well-formed PostGIS value, nested
parts carry different SRIDs, or |
geometry_type
property
¶
geometry_type: str
The PostGIS shape kind, such as 'Point' or 'MultiPolygon'.
SpatialParameter
dataclass
¶
SpatialParameter(value: Geometry, srid: int)
Bind a gometry value with an explicit SRID from the destination database.
Use it when more than one SRID in the database's spatial_ref_sys
defines the value's CRS, or to state the destination SRID explicitly. The
SQL parameter type selects geometry or geography. Gres checks that
the value's CRS matches that SRID's definition and that its model matches
the family; it never transforms coordinates. A typed destination column
with a different SRID rejects the value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Geometry
|
A gometry geometry with a declared CRS. |
required |
srid
|
int
|
A positive SRID from the destination database's
|
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
|