PostGIS Feature Representation

Features read from PostGIS consist of a series of attribute values and geometry. The feature type of each feature is as defined on its DEF line. The geometry object model in PostGIS follows the OGIS Simple Features Specification 1.1. For more information see http://www.opengis.org.

Features written to the database have the destination table as their feature type, and attributes as defined on the DEF line.

In addition to the generic FME feature attributes that FME Workbench adds to all features (see About Feature Type Attributes), this format adds the format-specific attributes described in this topic.

Attribute Name

Contents

postgis_type

The type of geometric entity stored within the feature. The valid values for the object model are listed below:

postgis_point

postgis_multipoint

postgis_linestring

postgis_multilinestring

postgis_circularstring

postgis_compoundcurve

postgis_multicurve

postgis_polygon

postgis_multipolygon

postgis_curvepolygon

postgis_multisurface

postgis_triangle

postgis_polyhedralsurface

postgis_tin

postgis_geometrycollection

postgis_none

postgres_oid Tables in a PostgreSQL database may be created with an OID column, although this is typically used only by system tables. This attribute is present and set to the value of the OID column if it is present in the table being read.

Features read from, or written to, PostGIS also have an attribute for each column in the database table. The feature attribute name will be the same as the source or destination column name. The attribute and column names are case-sensitive.

No Coordinates

postgis_type: postgis_none

Features with no coordinates are tagged with this value when reading from PostGIS. Note that when reading or writing attribute-only data tables, the PostgreSQL reader/writer should be used instead. Note also that this is not a valid OGC type.

Point

postgis_type: postgis_point

Features tagged with this value consist of a single point.

MultiPoint

postgis_type: postgis_multipoint

Features tagged with this value consist of a collection of points.

LineString

postgis_type: postgis_linestring

Features tagged with this value consist of a single line.

MultiLineString

postgis_type: postgis_multilinestring

Features tagged with this value consist of a collection of lines.

CircularString

postgis_type: postgis_circularstring 

Features tagged with this value consist of a path of circular arcs.

CompoundCurve

postgis_type: postgis_compoundcurve 

Features tagged with this value consist of a path of lines and/or circular arcs.

MultiCurve

postgis_type: postgis_multicurve 

Features tagged with this value consist of a collection of lines and paths of circular arcs.

Note that paths containing both lines and circular arcs may not be stored in a MultiCurve.

Polygon

postgis_type: postgis_polygon

Features tagged with this value consist of a linear polygon or donut.

MultiPolygon

postgis_type: postgis_multipolygon 

Features tagged with this value consist of a collection of linear polygons and/or donuts.

CurvePolygon

postgis_type: postgis_curvepolygon 

Features tagged with this value consist of a linear or curved polygon or donut.

MultiSurface

postgis_type: postgis_multisurface 

Features tagged with this value consist of a collection of linear and/or curved polygons and/or donuts.

Triangle

postgis_type: postgis_triangle

Features tagged with this value consist of a linear triangular polygon, with X, Y, and Z components on each vertex.

PolyhedralSurface

postgis_type: postgis_polyhedralsurface

Features tagged with this value consist of a collection of linear polygons (not donuts) forming a single contiguous orientable non-self-intersecting surface. The vertices of these polygons have X, Y, and Z components.

TIN

postgis_type: postgis_tin

Features tagged with this value are PolyhedralSurfaces where every polygon in the feature is a triangle.

GeometryCollection

postgis_type: postgis_geometrycollection

Features tagged with this value consist of a possibly heterogeneous aggregate.

When writing to PostGIS, the postgis_type can be manually set to postgis_geometrycollection and features will be combined into collections based on the postgis_collection_id attribute.

Geometry

postgis_type: postgis_geometry

Although not a valid geometry type on an individual feature, this type may be set for the destination geometry column type to indicate that any geometry is allowable in that column. If the writer directive GENERIC_GEOMETRY is specified at generation time, all destination feature types will have geometry columns of this type. Alternatively, although it will not happen by default, this type can be specified on any one or more destination feature types manually to create generic geometry columns on those specific tables.

Note that although the geometry column is explicitly determined by the user when writing, the reader will attempt to determine the geometry column name and type using the PostGIS metadata tables.

In cases where the PostGIS reader is applied to databases lacking the proper metadata tables or entries, then the first column whose type would allow for geometry storage is taken as the geometry column. This decision may cause the translation to fail if the column does not indeed contain geometry. To work around this case, please use the PostgreSQL reader instead, which ignores geometry columns. Alternatively, if there are multiple geometry columns or a mixture of blob columns and geometry columns and the geometry is still desired, try formatting a custom SQL query that selects the geometry column the first column.

Note also that geometry columns can be stored in either geometry or blob columns but these may contain other data as well. Geometry columns that do not correspond to the geometry of the feature will be read as hex-encoded strings and blobs will be read as raw bytes.