ST_Area

定义

ST_Area 返回面或多面的面积。

语法

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

返回类型

双精度型

示例

城市工程师需要一个建筑物面积的列表。为创建该列表,GIS 技术人员选择建筑物 ID 以及每个建筑物的覆盖区的面积。

建筑物覆盖区存储在使用以下 CREATE TABLE 语句创建的 bfp 表中:

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)
);

为满足城市工程师的请求,技术人员从 bfp 表中选择唯一键 building_id 和每个建筑物覆盖区的面积。

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

7/10/2012