ArcGIS Desktop

  • 文档
  • 支持

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS for Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

ST_Centroid

  • 定义
  • 语法
  • 返回类型
  • 示例

定义

ST_Centroid 以面或多面要素为输入,然后返回位于几何的包络矩形中心的点。这意味着,质心点在几何的最小和最大 x 和 y 范围的中间位置。

语法

Oracle 和 PostgreSQL

sde.st_centroid (polygon sde.st_geometry)
sde.st_centroid (multipolygon sde.st_geometry)

SQLite

st_centroid (polygon geometryblob)
st_centroid (multipolygon geometryblob)

返回类型

ST_Point

示例

城市 GIS 技术人员想要在建筑物密度图中将建筑物覆盖区多面显示为单个点。建筑物覆盖区存储在 bfp 表中,该表由各数据库显示使用的语句所创建并填充。

Oracle

--Create and populate table
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))', 4326)
);

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

INSERT INTO bfp VALUES (
 3,
 sde.st_polygon ('polygon ((20 30, 25 35, 30 30, 20 30))', 4326)
);
--The ST_Centroid function returns the centroid of each building footprint multipolygon. 
--The ST_AsText function converts each centroid point into a text representation recognized by the application.
SELECT building_id,
 sde.st_astext (sde.st_centroid (footprint)) Centroid
 FROM bfp;

BUILDING_ID                   Centroid

   1                     POINT  (5.00000000 5.00000000)
   2                     POINT  (30.00000000 10.00000000)
   3                     POINT  (25.00000000 32.50000000)

PostgreSQL

--Create and populate table
CREATE TABLE bfp (
 building_id serial,
 footprint sde.st_geometry);

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

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

INSERT INTO bfp (footprint) VALUES (
 sde.st_polygon ('polygon ((20 30, 25 35, 30 30, 20 30))', 4326)
);
--The ST_Centroid function returns the centroid of each building footprint multipolygon. 
--The ST_AsText function converts each centroid point into a text representation recognized by the application.
SELECT building_id, sde.st_astext (sde.st_centroid (footprint)) 
 AS centroid
 FROM bfp;

building_id                  centroid

   1                     POINT  (5 5)
   2                     POINT  (30 10)
   3                     POINT  (25 33)

SQLite

--Create table, add geometry column, and populate table
CREATE TABLE bfp (
 building_id integer primary key autoincrement not null
);

SELECT AddGeometryColumn (
 NULL,
 'bfp',
 'footprint',
 4326,
 'polygon',
 'xy',
 'null'
);

INSERT INTO bfp (footprint) VALUES (
 st_polygon ('polygon ((0 0, 0 10, 10 10, 10 0, 0 0))', 4326)
);

INSERT INTO bfp (footprint) VALUES (
 st_polygon ('polygon ((20 0, 30 20, 40 0, 20 0))', 4326)
);

INSERT INTO bfp (footprint) VALUES (
 st_polygon ('polygon ((20 30, 25 35, 30 30, 20 30))', 4326)
);
--The ST_Centroid function returns the centroid of each building footprint multipolygon. 
--The ST_AsText function converts each centroid point into a text representation recognized by the application.
SELECT building_id, st_astext (st_centroid (footprint)) 
 AS "centroid"
 FROM bfp;

building_id              centroid

   1                     POINT  (5.00000000 5.00000000)
   2                     POINT  (30.00000000 10.0000000)
   3                     POINT  (25.00000000 32.5000000)

相关主题

  • 加载 SQLite ST_Geometry 库

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS 平台

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • Esri 博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2018 Esri. | 隐私政策 | 法律声明