gws.plugin.model_field.geometry

Geometry field.

A scalar field for geometries, stored as gws.Shape objects. The geometry type and the CRS are taken from the config or, if not configured, from the database column. A field without a known CRS is a configuration error.

The field supports geometry searches: when a model is searched with a shape (optionally widened by a tolerance) or with bounds, the field adds an ST_Intersects condition on its column. Shapes from the client are transformed to the field CRS. Without a configured widget, the field uses a geometry widget.

Example:

fields+ {
    name "geom"
    type "geometry"
    geometryType "polygon"
    crs "EPSG:25832"
}

Source code: gws.plugin.model_field.geometry

Package Contents

class gws.plugin.model_field.geometry.Config

Bases: gws.base.model.scalar_field.Config

Field for geometries.

crs: gws.CrsName | None

CRS of the geometries.

geometryType: gws.GeometryType | None

Geometry type.

class gws.plugin.model_field.geometry.Object

Bases: gws.base.model.scalar_field.Object

Geometry field object.

attributeType
geometryCrs: gws.Crs

CRS of the stored geometries.

geometryType: gws.GeometryType

Geometry type of the field.

supportsGeometrySearch = True
before_select(mc)
configure()
configure_geometry_crs()

Set the CRS from the config or from the SRID of the database column.

Returns:

True if the CRS was set, None otherwise.

configure_geometry_type()

Set the geometry type from the config or from the database column.

Returns:

True if the geometry type was set, None otherwise.

configure_widget()
prop_to_python(feature, value, mc)
props(user)
python_to_prop(feature, value, mc)
python_to_raw(feature, value, mc)
raw_to_python(feature, value, mc)
class gws.plugin.model_field.geometry.Props

Bases: gws.base.model.scalar_field.Props

geometryType: gws.GeometryType