unprepare
Frees the prepared internal spatial indexes.
Call this function when you no longer need a performance boost, but need the geometry itself and want to reclaim some memory.
The prepared internal spatial indexes will be automatically freed alongside
the geometry itself, either when released via free
or when geometry goes out of scope.
Modifies the geometry in-place.
Type Parameters
Parameters
Name | Type | Description |
---|---|---|
geometry | Prepared<G> | Geometry to free its prepared indexes |
Returns
G
Exactly the same geometry object, but without prepared internal spatial indexes
See also
prepare
prepares geometry internal spatial indexesisPrepared
checks whether a geometry is prepared- https://libgeos.org/usage/c_api/#prepared-geometry
Examples
lifecycle of the prepared geometry
const regularPolygon = buffer(point([ 0, 0 ]), 10, { quadrantSegments: 1000 });
const preparedPolygon = prepare(regularPolygon);
const regularPolygonAgain = unprepare(preparedPolygon);
// `regularPolygon`, `preparedPolygon` and `regularPolygonAgain` are exactly the same object
// so if you do not care about TypeScript, the above can be simplified to:
const p = buffer(point([ 0, 0 ]), 10, { quadrantSegments: 1000 });
prepare(p);
unprepare(p);