Definición
ST_PointOnSurface toma un ST_Polygon o ST_MultiPolygon y devuelve un ST_Point garantizado para permanecer en su superficie.
Sintaxis
Oracle y PostgreSQL
sde.st_pointonsurface (polygon1 sde.st_geometry) sde.st_pointonsurface (multipolygon1 sde.st_geometry)
SQLite
st_pointonsurface (polygon1 geometryblob) st_pointonsurface (multipolygon1 geometryblob)
Tipo de devolución
ST_Point
Ejemplo
El ingeniero de la ciudad quiere crear un punto de etiqueta para la huella de cada edificio histórico. Las huellas de los edificios históricos se almacenan en la tabla hbuildings que se creó con la siguiente declaración CREATE TABLE:
La función ST_PointOnSurface genera un punto que se asegura que debe estar en la superficie de las huellas de edificios. La función ST_PointOnSurface devuelve un punto que la función ST_AsText convierte a texto para que use la aplicación.
Oracle
CREATE TABLE hbuildings (
hbld_id integer,
hbld_name varchar(40),
footprint sde.st_geometry
);
INSERT INTO hbuildings (hbld_id, hbld_name, footprint) VALUES (
1,
'First National Bank',
sde.st_polygon ('polygon ((0 0, 0 .010, .010 .010, .010 0, 0 0))', 4326)
);
INSERT INTO hbuildings (hbld_id, hbld_name, footprint) VALUES (
2,
'Courthouse',
sde.st_polygon ('polygon ((.020 0, .020 .010, .030 .010, .030 0, .020 0))', 4326)
);
SELECT sde.st_astext (sde.st_pointonsurface (footprint)) Historic_Site
FROM HBUILDINGS;
HISTORIC_SITE
POINT (0.00500000 0.00500000)
POINT (0.02500000 0.00500000)
PostgreSQL
CREATE TABLE hbuildings (
hbld_id serial,
hbld_name varchar(40),
footprint sde.st_geometry
);
INSERT INTO hbuildings (hbld_name, footprint) VALUES (
'First National Bank',
sde.st_polygon ('polygon ((0 0, 0 .010, .010 .010, .010 0, 0 0))', 4326)
);
INSERT INTO hbuildings (hbld_name, footprint) VALUES (
'Courthouse',
sde.st_polygon ('polygon ((.020 0, .020 .010, .030 .010, .030 0, .020 0))', 4326)
);
SELECT sde.st_astext (sde.st_pointonsurface (footprint))
AS "Historic Site"
FROM hbuildings;
Historic Site
POINT (0.00500000 0.00500000)
POINT (0.02500000 0.00500000)
SQLite
CREATE TABLE hbuildings (
hbld_id integer primary key autoincrement not null,
hbld_name text(40)
);
SELECT AddGeometryColumn(
NULL,
'hbuildings',
'footprint',
4326,
'polygon',
'xy',
'null'
);
INSERT INTO hbuildings (hbld_name, footprint) VALUES (
'First National Bank',
st_polygon ('polygon ((0 0, 0 .010, .010 .010, .010 0, 0 0))', 4326)
);
INSERT INTO hbuildings (hbld_name, footprint) VALUES (
'Courthouse',
st_polygon ('polygon ((.020 0, .020 .010, .030 .010, .030 0, .020 0))', 4326)
);
SELECT st_astext (st_pointonsurface (footprint))
AS "Historic Site"
FROM hbuildings;
Historic Site
POINT (0.00500000 0.00500000)
POINT (0.02500000 0.00500000)