-- The dimension_test table is created with the columns geotype and g1. -- The geotype column stores the name of the subclass stored in the g1 -- geometry column. CREATE TABLE dimension_test (geotype varchar(20), g1 ST_Geometry); -- The INSERT statements insert a sample subclass into the dimension_test table. INSERT INTO dimension_test VALUES( 'Point', ST_PointFromText('point (10.02 20.01)',1000) ); INSERT INTO dimension_test VALUES( 'Linestring', ST_LineFromText('linestring (10.02 20.01,10.32 23.98,11.92 25.64)',1000) ); INSERT INTO dimension_test VALUES( 'Polygon', ST_PolyFromText('polygon ((10.02 20.01,11.92 35.64,25.02 34.15, 19.15 33.94,10.02 20.01))',1000) ); INSERT INTO dimension_test VALUES( 'Multipoint', ST_MPointFromText('multipoint (10.02 20.01,10.32 23.98,11.92 25.64)',1000) ); INSERT INTO dimension_test VALUES( 'Multilinestring', ST_MLineFromText('multilinestring ((10.02 20.01,10.32 23.98,11.92 25.64),(9.55 23.75,15.36 30.11))',1000) ); INSERT INTO dimension_test VALUES( 'Multipolygon', ST_MPolyFromText('multipolygon (((10.02 20.01,11.92 35.64,25.02 34.15,19.15 33.94,10.02 20.01)),((51.71 21.73,73.36 27.04,71.52 32.87,52.43 31.90,51.71 21.73)))',1000) ); -- The select statement lists the subclass name stored in the -- geotype column with the dimension of that geotype. SELECT geotype, ST_Dimension(g1) Dimension FROM dimension_test;