New geometries in PostGIS




Twelve geometries already exist in PostGIS :
Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, Curve, MultiCurve, PolygonCurve, MultiSurface and GeometryCollection.

Two geometries are added to support 3D geometries in PostGIS, they are some specific MultiPolygon described in OGC SFS1.2 norm.

The SQL syntax is the same for these two new geometries and MultiPolygons :


















MultiPolygon(
-FACE 1- (x11 y11 z11, x12 y12 z12, x13 y13 z13, x14 y14 z14, x15 y15 z15),
-FACE 2- (x21 y21 z21, x22 y22 z22, x23 y23 z23, x24 y24 z24, x15 y15 z15),
-FACE 3- (x31 y31 z31, x32 y32 z32, x33 y33 z33, x34 y34 z34, x35 y35 z35)
) ;

In fact, a MultiPolygon needs five points for a square, because the faces must be closed. Moreover, two contiguous polygons must have the same orientation :









These new geometries are :

  • POLYHEDRALSURFACE
Definition : Collection of contiguous 3D polygons which share some edges and describe 3D volume.

SQL syntax : Example for a cube.





POLYHEDRALSURFACE(
-BOTTOM- (0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0),
-LEFT- (0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0),
-FRONT- (0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0),
-TOP- (0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1),
-RIGHT- (1 0 0, 1 1 0, 1 1 1, 1 0 1, 1 0 0),
-BACK- (1 1 0, 0 1 0, 0 1 1, 1 1 1, 1 1 0)
) ;

  • TIN
Definition : A Triangular Irregular Network is a POLYHEDRALSURFACE where all Polygons are Triangles.

SQL syntax : Example for a tetrahedron.















TIN
(
-BOTTOM- (0 0 0, 1 0 0, 0 1 0, 0 0 0),
-FRONT- (0 0 0, 1 0 0, 0 0 1, 0 0 0),
-LEFT- (0 0 0, 0 0 1, 0 1 0, 0 0 0),
-RIGHT- (0 0 1, 1 0 0, 0 1 0, 0 0 1)
) ;

It's also possible to create 2D TIN or POLYHEDRALSURFACE but their main aim is to describe 3D volumes.

Unfortunately, it's not possible to create TIN & POLYHEDRALSURFACE with MultiRings Polygons. Indeed, their mathematical definition specify that PolyhedralSurfaces can't have holes.

However, some PostGIS export functions are available for these geometries :
  • asEWKB
  • asEWKT
  • asKML
  • asSVG (only 2D output)
  • asGML (only 2D output)
  • Summary

Here is some examples of TIN & POLYHEDRALSURFACE manipulation :

__________________________________________________________________________________________________________

SELECT asEWKT('TIN(((1 2 3, 3 4 5, 4 5 6, 1 2 3)))') ;

SELECT asSVG('POLYHEDRALSURFACE(((0 0, 0 1, 1 1, 1 0, 0 0)), ((1 0, 2 0, 2 1, 1 1, 1 0)))') ;

SELECT asGML('POLYHEDRALSURFACE(((0 0, 0 1, 1 1, 1 0, 0 0)), ((1 0, 2 0, 2 1, 1 1, 1 0)))') ;
__________________________________________________________________________________________________________