PostGreSQL/PostGIS
PostGreSQL with the PostGIS extension is a relational database system that supports the storage of spatial objects.
Spectrum Spatial treats a PostGreSQL/PostGIS data source as a read-write data source.
Supported Data Types
The PostGreSQL/PostGIS data source provider follows the same rules as the JDBC data source provider when mapping a non-spatial JDBC data type to Spectrum Spatial’s type system.
The PostGIS geometry and geography data types are the spatial data equivalent to Spectrum Spatial's supported data types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.
Determining the spatial metadata is done in several steps. The first step looks at the MAPINFO_MAPCATALOG table in the MAPINFO schema and if an entry exists identifies the geometry column in the PostGIS table and the style column. If the table is identified as being an X/Y table then the two columns identified as the X and Y columns will be “fused” together into a geometry column in the spatial table with the coordinate system specified in the MAPINFO_MAPCATALOG. If the MAPINFO_MAPCATALOG does not exists or the table to be opened does not have an entry then the GEOMETRY_COLUMNS table is consulted for the name of the spatial column and its coordinate system.
Upcasting and Downcasting Geometries
When inserting or updating geometries for PostGreSQL/PostGIS, upcasting and downcasting of geometries are supported.
For example:
- Polygon geometries can be inserted into tables that are configured to accept geometries of a MultiPolygon type.
- MultiPolygon geometries can be inserted into tables that are configured to accept geometries of a Polygon type, if the MultiPolygon contains a single Polygon.
Primary Key
Spectrum Spatial follows the same rules as the JDBC data source provider for determining the primary key.
Read-Only Columns
Spectrum Spatial follows the same rules as the JDBC data source provider in determining whether a column is read-only. It marks auto-increment columns as read-only as well.
MI SQL Optimizations
PostGreSQL/PostGIS supports the same functions and operators as the JDBC data source provider data source provider.
PostGreSQL/PostGIS supports the following spatial operators:
- CentroidWithin (Examples)
- ContainsCentroid (Examples)
- Contains (Examples)
- Within (Examples)
- EnvelopesIntersect (Examples)
- Intersects (Examples)
For more information see the appendix Delegation to Data Source Providers.
Volatility
For PostGreSQL/PostGIS volatility is any change to the table's schema, such as adding or dropping a column or changing an index on a column. This includes a bounds change to the table via a direct database change. If it has changed, Spectrum Spatial will flush the metadata about the table from the cache and reload it before proceeding with the data access operation. See Data Source Volatility for more information.
XY Table Support
PostGreSQL/PostGIS tables can be accessed as XY tables. See XY Table Support.