Spatial Table Geometry Type Requirements

The types of geometries that a user will be able to create, or edit, are determined by the geometry column of the underlying spatial table.

The geometry types stored in a single geometry column should normally be homogeneous. That is if the column is defined to only store polygons, then points, lines and multi-polygons etc., cannot be stored.

Weave can also work with geometry columns that are allowed to hold heterogeneous geometry types i.e., a column that stores points, lines and polygons. For example, graffiti could be recorded as occurring at a particular location (point), or over an area (polygon).

An entity can be linked to two spatial tables e.g. one containing polygons, and one containing points. In this situation the user will be able to edit both points and polygons: the point data being automatically stored in one table and the polygon data the other. This is covered in the document “Editing Multiple Spatial Tables”.

There is a differentiation between those spatial layers that contain single instance geometries (point, line or polygon) and those that contain multi-instance geometries (multi-point, multi-line or multi-polygon). That is, if the spatial table contains multi-polygons, as opposed to just polygons, then the user will be allowed, when editing the entity, to create a geometry described by more than one polygon shape. When the spatial table contains polygons, the user will be limited to single polygon geometries. The same differentiation applies to points/multi-points and lines/multi-lines.

Whether a user can create a geometry is determined by the underlying spatial table. If the spatial table allows nil (null) geometries, then the user will not be forced to create a geometry when creating a new entity. However, if the spatial table doesn't allow nil geometries, then the user will be required to create a geometry before they will be able to complete an edit.

The graffiti table definition’s geometry column, geom, is:

  • Declared to only allow any type of geometry and

  • Declared without the NOT NULL clause thus allowing for NULL geometries.

As will be seen in the section on Editing Multiple Spatial Tables, the public.graffiti_p table definition’s geometry column, geom, is declared to allow only single instance points.

CREATE TABLE public.graffiti_p ( ... /* Geometry restricted to single points in SRID 4326 */ GEOM geometry(POINT,4326) );