123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- -- The example creates the convexhull_test table that has two columns:
- -- geotype and g1. Geotype, a varchar(20), stores the name of the geometry
- -- subclass that is stored in g1, a geometry.
- CREATE TABLE convexhull_test (geotype varchar(20),
- g1 ST_Geometry);
- -- The INSERT statements insert several geometry subclasses
- -- into the convexhull_test table.
- INSERT INTO convexhull_test VALUES(
- 'Point',
- ST_PointFromText('point (10.02 20.01)',1000)
- );
- INSERT INTO convexhull_test VALUES(
- 'Linestring',
- ST_LineFromText('linestring (10.02 20.01,10.32 23.98,11.92 25.64)',1000)
- );
- INSERT INTO convexhull_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 convexhull_test VALUES(
- 'MultiPoint',
- ST_MPointFromText('multipoint (10.02 20.01,10.32 23.98,11.92 25.64)',1000)
- );
- INSERT INTO convexhull_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 convexhull_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 and the convex hull.
- SELECT geotype, ST_ConvexHull(g1) convexhull
- FROM convexhull_test;
|