ArcGIS Server Banner

ST_NumGeometries

ST_NumGeometries

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback
Note: This topic was updated for 9.3.1.

Definition

ST_NumGeometries takes a geometry collection and returns the number of geometries in the collection.

Syntax

Oracle

sde.st_numgeometries (mpt1 sde.st_geometry)
sde.st_numgeometries (mln1 sde.st_geometry)
sde.st_numgeometries (mpl1 sde.st_geometry)

PostgreSQL

st_numgeometries (mpt1 st_geometry)
st_numgeometries (mln1 st_geometry)
st_numgeometries (mpl1 st_geometry)

Return type

Integer

Example

Oracle

CREATE TABLE sample_numgeom (id integer, geometry sde.st_geometry);

INSERT INTO sample_numgeom VALUES (
1,
sde.st_multipolygon ('multipolygon (((3 3, 4 6, 5 3, 3 3), (8 24, 9 25, 1 28, 8 24), (13 33, 7 36, 1 40, 10 43, 13 33)))', 0)
);

INSERT INTO sample_numgeom VALUES (
2,
sde.st_multipoint ('multipoint (1 2, 4 3, 5 6, 7 6, 8 8)', 0)
);

SELECT id, sde.st_numgeometries (geometry) NUM_GEOMS_IN_COLL
FROM sample_numgeom;

ID          NUM_GEOMS_IN_COLL

  1                 3
  2                 5

PostgreSQL

CREATE TABLE sample_numgeom (id integer, geometry st_geometry);

INSERT INTO sample_numgeom VALUES (
1,
st_multipolygon ('multipolygon (((3 3, 4 6, 5 3, 3 3), (8 24, 9 25, 1 28, 8 24), (13 33, 7 36, 1 40, 10 43, 13 33)))', 0)
);

INSERT INTO sample_numgeom VALUES (
2,
st_multipoint ('multipoint (1 2, 4 3, 5 6, 7 6, 8 8)', 0)
);

SELECT id, st_numgeometries (geometry) AS "number of geometries"
FROM sample_numgeom;

id          number of geometries

  1                 3
  2                 5

See Also

  • An overview of SQL functions used with ST_Geometry types