123456789101112131415161718192021222324252627 |
- -- The numpoints_test table is created with the geotype column,
- -- which contains the ST_Geometry type stored in the g1 geometry column.
- CREATE TABLE numpoints_test (geotype varchar(12),
- g1 ST_Geometry);
- -- The INSERT statements insert a point, a linestring, and a polygon.
- INSERT INTO numpoints_test VALUES(
- 'point',
- ST_PointFromText('point (10.02 20.01)',1000)
- );
- INSERT INTO numpoints_test VALUES(
- 'linestring',
- ST_LineFromText('linestring (10.02 20.01, 23.73 21.92)',1000)
- );
- INSERT INTO numpoints_test VALUES(
- 'polygon',
- ST_PolyFromText('polygon ((10.02 20.01, 23.73 21.92, 24.51 12.98, 11.64 13.42, 10.02 20.01))',1000)
- );
- -- The query lists the geometry type and the number of points in each.
- SELECT geotype, ST_NumPoints(g1) Number_of_points
- FROM numpoints_test;
|