ST_Area

Definition

ST_Area returns the area of a polygon or multipolygon.

Syntax

sde.st_area (pl1 sde.st_geometry)
sde.st_area (mpl1 sde.st_geometry)

Return type

Double precision

Example

The city engineer needs a list of building areas. To create the list, a GIS technician selects the building ID and area of each building's footprint.

The building footprints are stored in the bfp table created with the following CREATE TABLE statement:

Oracle

CREATE TABLE bfp (
building_id integer,
footprint sde.st_geometry);

INSERT INTO BFP VALUES (
1, 
sde.st_polygon ('polygon ((0 0, 0 10, 10 10, 10 0, 0 0))', 0)
);

INSERT INTO BFP VALUES (
2, 
sde.st_polygon ('polygon ((20 0, 30 20, 40 0, 20 0))', 0)
);

INSERT INTO BFP VALUES (
3,
sde.st_polygon ('polygon ((20 30, 25 35, 30 30, 20 30))', 0)
);

PostgreSQL

CREATE TABLE bfp (
building_id integer unique,
footprint sde.st_geometry);

INSERT INTO bfp VALUES (
1, 
sde.st_polygon ('polygon ((0 0, 0 10, 10 10, 10 0, 0 0))', 0)
);

INSERT INTO bfp VALUES (
2, 
sde.st_polygon ('polygon ((20 0, 30 20, 40 0, 20 0))', 0)
);

INSERT INTO bfp VALUES (
3,
sde.st_polygon ('polygon ((20 30, 25 35, 30 30, 20 30))', 0)
);

To satisfy the city engineer's request, the technician selects the unique key, the building_id, and the area of each building footprint from the bfp table.

Oracle

SELECT building_id, sde.st_area (footprint) Area
FROM BFP;

BUILDING_ID       Area

          1        100
          2        200
          3         25

PostgreSQL

SELECT building_id, sde.st_area (footprint) 
AS Area
FROM bfp;

building_id       area

          1        100
          2        200
          3         25

11/18/2013