gi-nx / evaluateFeatures
Param
The raw sections to evaluate. Polygon rings must be wound per RFC 7946 (see above).
Param
Optional context overrides.
Param
Optional output options, e.g. { stack: true }.
Example
rpc.invoke("evaluateFeatures", [rawSections]);
// evaluate and stack in one call:
rpc.invoke("evaluateFeatures", [rawSections, undefined, { stack: true }]);Call Signature
function evaluateFeatures(
features: (
| RawPoint
| RawMultiPoint
| RawLineString
| RawMultiLineString
| RawPolygon
| RawMultiPolygon)[],
context?: Omit<ProjectBundle, "bakedSectionsGroup">,
options?: {
stack?: false;
}): Record<string, (
| PreStackedPoint
| PreStackedLineString
| PreStackedPolygon<Record<string, any>>)[]>;Evaluates a set of raw sections against the current project state, producing pre-stacked sections keyed by feature ID.
Polygon winding: Input polygon geometries must follow the RFC 7946 right-hand rule — outer rings counter-clockwise, holes clockwise. The evaluator does not rewind input, and incorrectly-wound polygons may produce empty, inverted, or otherwise incorrect output. If your features come from a source that does not guarantee RFC 7946 winding, rewind them yourself first (e.g. with @mapbox/geojson-rewind).
Parameters
| Parameter | Type | Description |
|---|---|---|
features | ( | RawPoint | RawMultiPoint | RawLineString | RawMultiLineString | RawPolygon | RawMultiPolygon)[] | Raw sections to evaluate. Polygon rings must be wound per RFC 7946 (see above). |
context? | Omit<ProjectBundle, "bakedSectionsGroup"> | Optional overrides. If this is not set, the project that is currently active will be used. |
options.stack? | false | - |
Returns
Record<string, ( | PreStackedPoint | PreStackedLineString | PreStackedPolygon<Record<string, any>>)[]>
A map from each feature's ID to its evaluated PreStackedSection array.
Examples
const features = [
{
type: 'Feature',
geometry: {
type: 'Polygon',
coordinates: [
[
[151.29261804, -33.80972803],
[151.29261804, -33.8099807],
[151.29291899, -33.8099807],
[151.29291898, -33.80972803],
[151.29261804, -33.80972803],
],
],
},
properties: {
id: 'nN8LKLcFMJDJWEQTKj1ZD',
flow: {
id: '055897e4d98e444388ee1a168e782cdc',
inputs: { radius: 12 },
},
usage: 'Residential',
levels: 4,
layerId: 'default',
stackOrder: 0,
},
},
];
const result = evaluateFeatures(features);
// result['nN8LKLcFMJDJWEQTKj1ZD'] -> PreStackedSection[]// Evaluate against a different project by passing its bundle as context.
const bundle = await getProjectBundle(otherProjectId);
const result = evaluateFeatures(features, bundle);// Evaluate and stack in a single call — avoids a second round-trip through stackFeatures.
const result = evaluateFeatures(features, undefined, { stack: true });
// result['nN8LKLcFMJDJWEQTKj1ZD'] -> StackedSection[]Call Signature
function evaluateFeatures(
features: (
| RawPoint
| RawMultiPoint
| RawLineString
| RawMultiLineString
| RawPolygon
| RawMultiPolygon)[],
context: Omit<ProjectBundle, "bakedSectionsGroup">,
options: {
stack: true;
}): Record<string, StackedSection[]>;Evaluates a set of raw sections against the current project state, producing pre-stacked sections keyed by feature ID.
Polygon winding: Input polygon geometries must follow the RFC 7946 right-hand rule — outer rings counter-clockwise, holes clockwise. The evaluator does not rewind input, and incorrectly-wound polygons may produce empty, inverted, or otherwise incorrect output. If your features come from a source that does not guarantee RFC 7946 winding, rewind them yourself first (e.g. with @mapbox/geojson-rewind).
Parameters
| Parameter | Type | Description |
|---|---|---|
features | ( | RawPoint | RawMultiPoint | RawLineString | RawMultiLineString | RawPolygon | RawMultiPolygon)[] | Raw sections to evaluate. Polygon rings must be wound per RFC 7946 (see above). |
context | Omit<ProjectBundle, "bakedSectionsGroup"> | Optional overrides. If this is not set, the project that is currently active will be used. |
options.stack | true | - |
Returns
Record<string, StackedSection[]>
A map from each feature's ID to its evaluated PreStackedSection array.
Examples
const features = [
{
type: 'Feature',
geometry: {
type: 'Polygon',
coordinates: [
[
[151.29261804, -33.80972803],
[151.29261804, -33.8099807],
[151.29291899, -33.8099807],
[151.29291898, -33.80972803],
[151.29261804, -33.80972803],
],
],
},
properties: {
id: 'nN8LKLcFMJDJWEQTKj1ZD',
flow: {
id: '055897e4d98e444388ee1a168e782cdc',
inputs: { radius: 12 },
},
usage: 'Residential',
levels: 4,
layerId: 'default',
stackOrder: 0,
},
},
];
const result = evaluateFeatures(features);
// result['nN8LKLcFMJDJWEQTKj1ZD'] -> PreStackedSection[]// Evaluate against a different project by passing its bundle as context.
const bundle = await getProjectBundle(otherProjectId);
const result = evaluateFeatures(features, bundle);// Evaluate and stack in a single call — avoids a second round-trip through stackFeatures.
const result = evaluateFeatures(features, undefined, { stack: true });
// result['nN8LKLcFMJDJWEQTKj1ZD'] -> StackedSection[]