Name
ST_BuildArea — Creates a surface geometry from the lines of the input
geometries.
Synopsis
geometry ST_BuildArea(
bytea
Geometry)
;
Description
Creates a surface geometry from the lines of the input
geometries.
| |
---|
This method supports GeometryCollections |
Coordinate Dimensions
Spatial Standards Support
Examples
CREATE TABLE "lines"(id serial PRIMARY KEY);
SELECT AddGeometryColumn ('lines','GEOM',25830,'LINESTRING',2);
INSERT INTO "lines" ("GEOM") VALUES (ST_GeomfromEWKT('SRID=25830;LINESTRING (1 1, 1 4, 1 7)'));
INSERT INTO "lines" ("GEOM") VALUES (ST_GeomfromEWKT('SRID=25830;LINESTRING (1 7, 3 7, 6 7)'));
INSERT INTO "lines" ("GEOM") VALUES (ST_GeomfromEWKT('SRID=25830;LINESTRING (6 7, 6 3, 6 1)'));
INSERT INTO "lines" ("GEOM") VALUES (ST_GeomfromEWKT('SRID=25830;LINESTRING (1 1, 4 1, 6 1)'));
--H2
SELECT asewkt(ST_BuildArea(ST_CollectAgg("lines"."GEOM"))) as polygon from "lines";
--PostgreSQL
SELECT asewkt(ST_BuildArea(ST_Collect("lines"."GEOM"))) as polygon from "lines";
SELECT DropGeometryTable ('lines');
--Result
polygon
--------------------------------------------------------------------
SRID=25830;POLYGON ((1 7, 3 7, 6 7, 6 3, 6 1, 4 1, 1 1, 1 4, 1 7))
(1 row)
SELECT ST_asewkt(ST_BuildArea(ST_GeomfromText('MULTILINESTRING ((1 1, 1 5, 6 5, 6 1, 1 1),
(3 7, 3 3, 8 3, 8 8, 3 8, 3 7))')));
--Result
MULTIPOLYGON (((3 7, 3 8, 8 8, 8 3, 6 3, 6 5, 3 5, 3 7)), ((3 5, 3 3, 6 3, 6 1, 1 1, 1 5, 3 5)))