ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Ayuda
  • Sign Out
ArcGIS Desktop

ArcGIS Online

La plataforma de representación cartográfica para tu organización

ArcGIS Desktop

Un completo SIG profesional

ArcGIS Enterprise

SIG en tu empresa

ArcGIS for Developers

Herramientas para crear aplicaciones basadas en la ubicación

ArcGIS Solutions

Plantillas de aplicaciones y mapas gratuitas para tu sector

ArcGIS Marketplace

Obtén aplicaciones y datos para tu organización.

  • Documentación
  • Soporte
Esri
  • Iniciar sesión
user
  • Mi perfil
  • Cerrar sesión

ArcMap

  • Inicio
  • Introducción
  • Cartografiar
  • Analizar
  • Administrar datos
  • Herramientas
  • Extensiones

ST_Centroid

  • Definición
  • Sintaxis
  • Tipo de devolución
  • Ejemplo

Definición

ST_Centroid toma un polígono, un multipolígono o una cadena de texto multilínea y devuelve el punto que está en el centro del sobre de geometría. Esto significa que el punto centroide está en medio entre las extensiones x e y mínima y máxima de la geometría.

Sintaxis

Oracle y PostgreSQL

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

SQLite

st_centroid (polygon geometryblob)
st_centroid (multipolygon geometryblob)
st_centroid (multilinestring geometryblob)

Tipo de devolución

ST_Point

Ejemplo

El técnico SIG de la ciudad desea visualizar los multipolígonos de la huella de edificio como puntos únicos en un gráfico de densidad del edificio. Las huellas de edificios se almacenan en la tabla bfp creada y completada con las declaraciones que se muestran para cada base de datos

Oracle 11g

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

Temas relacionados

  • Cargar la biblioteca ST_Geometry de SQLite

ArcGIS Desktop

  • Inicio
  • Documentación
  • Soporte

Plataforma ArcGIS

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

Acerca de Esri

  • Quiénes somos
  • Empleo
  • Blog de Esri
  • Conferencia de usuarios
  • Cumbre de desarrolladores
Esri
Díganos su opinión.
Copyright © 2019 Esri. | Privacidad | Legal