User's Guide and Reference

ST_NumGeometries

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

Syntax

db2gse.ST_NumGeometries(g db2gse.ST_GeomCollection)

Return type

Integer

Examples

The city engineer needs to know the actual number of distinct buildings associated with each building footprint.

The building footprints are stored in the BUILDINGFOOTPRINTS table that was created with the following CREATE TABLE statement.

CREATE TABLE BUILDINGFOOTPRINTS (   building_id integer,
                                         lot_id      integer,
                                         footprint   db2gse.ST_MultiPolygon);

The following SELECT statement uses the ST_NumGeometries function to list the BUILDING_ID that uniquely identifies each building and the number of buildings in each footprint.

SELECT building_id, db2gse.ST_NumGeometries (footprint) "Number of buildings"
FROM BUILDINGFOOTPRINTS;


[ Top of Page | Previous Page | Next Page ]