Skip to content
On this page

geos.GEOSGetGeometryN ⇒ number

Returns a geometry from a collection by index.

Kind: Exported member
Returns: number - A pointer to a newly allocated GEOSGeometry object corresponding to the geometry at index n. The caller is responsible for destroying it. Returns NULL on exception.

ParamTypeDescription
gnumberA pointer to a GEOSGeometry object of type GeometryCollection or its subclasses (MultiPoint, MultiLineString, MultiPolygon).
nnumberThe index of the geometry to return, starting from 0.

geos.GEOSGetGeometryN_r ⇒ number

Return the Nth geometry of a collection.

Kind: Exported member
Returns: number - A geometry object. Caller must free with GEOSGeom_destroy(). NULL on exception or if n is out of range.

ParamTypeDescription
handlenumberA pointer to the GEOS context handle.
gnumberThe input geometry, must be a collection.
nnumberThe index of the geometry to return, starting from 0.