Top

Name

ST_GeometryN — Given a 1-based index of a member of a MULTI... or ...COLLECTION shape, returns the member.

Synopsis

ST_GeometryN ( in shape any ,
  in idx any );
 

Description

Given a 1-based index of a member of a MULTI... or ...COLLECTION shape, returns the member.

Parameters

shape

Shape.

idx

Index.

Return Types

Returns any.

Examples

Example 24.660. Simple Use

SQL> select st_geometryn (
       st_geometryn (
         st_ewkt_read ('
           GEOMETRYCOLLECTION(
              POINT(0 0),
              MULTILINESTRING(
                (1 5,0 1,4 0,5 4),
                (1 5,1 0,4 0,4 5)),
              MULTIPOLYGON(
               ((1 3,2 4,1 5,0 4,1 3)),
               ((1 2,2 1,1 0,0 1,1 2))))'),
        3),1)
_______________________________________________________________________________

POLYGON((1.0 3.0,2.0 4.0,1.0 5.0,0.0 4.0,1.0 3.0))