gi-nx / updateRawSection
ts
function updateRawSection(feature: {
geometry?: | {
coordinates: [number, number];
type: "Point";
}
| {
coordinates: [number, number][];
type: "MultiPoint";
}
| {
coordinates: [number, number][];
type: "LineString";
}
| {
coordinates: [number, number][][];
type: "MultiLineString";
}
| {
coordinates: [number, number][][];
type: "Polygon";
}
| {
coordinates: [number, number][][][];
type: "MultiPolygon";
};
properties: {
id: string;
} & Partial<{
[key: string]: any;
angleOfRepose?: number;
appId?: string;
arrowEnd?: boolean;
arrowEndLength?: number;
arrowEndYawn?: number;
arrowStart?: boolean;
arrowStartLength?: number;
arrowStartYawn?: number;
baseHeight?: number;
bevel?: number;
bevelSegments?: number;
blockBasePoint?: boolean;
blockId?: string;
blockPropagation?: Record<string, "pass" | "force" | "stop">;
borderColor?: string;
borderRadius?: number;
borderStyle?: | "solid"
| "dotted"
| "dashed"
| "double"
| "groove"
| "ridge"
| "inset"
| "outset";
borderWidth?: number;
boxShadow?: number;
buildingID?: string;
childFeatures?: Feature<
| LineString
| Polygon, {
[name: string]: any;
}>[];
circleText?: boolean;
color?: string;
content?: string;
cornerRadius?: number;
corners?: "fillet" | "chamfer";
cutAndFill?: boolean;
cutAndFillOffset?: number;
dendrogram?: DendroRoot;
depth?: number;
doesStack?: boolean;
dwellingCount?: NumberKeyValueList;
dwellingCountPerLevel?: boolean;
dwellingMix?: NumberKeyValueList;
dwellingParkingRequired?: NumberKeyValueList;
dwellingPrice?: NumberKeyValueList;
dwellingResidents?: NumberKeyValueList;
dwellingSize?: NumberKeyValueList;
efficiency?: number;
elevationDatum?: number;
fillOpacity?: number;
floorToFloor?: number;
flow?: RawSectionFlowProp;
fromLayer?: string;
gltf?: string;
groupID?: string;
guidelineOffset?: number;
height?: number;
hideBackground?: boolean;
hideFloors?: boolean;
hideVerticals?: boolean;
id: string;
imageUrl?: string;
isDraped?: boolean;
label?: string;
labelColor?: string;
layerId?: string;
levels?: number;
loft?: boolean;
lotNumber?: string;
marker?: Marker;
markerAnchor?: | {
label: "Right";
value: "bottom left";
}
| {
label: "Left";
value: "bottom right";
}
| {
label: "Center";
value: "bottom";
};
markerIcon?: string;
maxWidth?: number;
mirror?: boolean;
noFacade?: boolean;
offset?: number;
offsetSide?: "right" | "left" | "both";
padding?: number;
parkingProvided?: number;
parkingRequired?: number;
pavementWidth?: number;
popup?: Record<string, any>;
popupBorderColor?: string;
popupBorderRadius?: number;
popupBorderWidth?: number;
popupColor?: string;
popupContent?: string;
popupHeight?: number;
popupImg?: string;
popupPadding?: number;
popupWidth?: number;
projectId: string;
public: true;
radius?: number;
roadWidth?: number;
rotation?: number;
scale?: number;
scenario?: string[];
sellEfficiency?: number;
shiny?: boolean;
slabThickness?: number;
sourceFeatureProperties?: Record<string, any>;
stackOrder?: number;
stickColor?: string;
stickHeight?: number;
stickWidth?: number;
stroke?: string;
strokeDasharray?: number[];
strokeLinecap?: "butt" | "round" | "square";
strokeLinejoin?: "bevel" | "round" | "miter";
strokeOpacity?: number;
strokeWidth?: number;
textColor?: string;
textSize?: number;
topThickness?: number;
type?: SectionType;
usage?: string;
visitorParkingRequired?: number;
width?: number;
}>;
}): void;Update an existing RawSection. Supports partial updates — only pass the properties you want to change. The id field must be set in properties to identify which section to update.
The function merges your changes with the existing section: geometry is replaced only if provided, and properties are shallow-merged (your values overwrite existing ones, unmentioned properties are kept). Pass null for a property value to delete it.
NB. rate limited - do not call this unless there is a corresponding user action
Parameters
| Parameter | Type | Description |
|---|---|---|
feature.geometry? | | { coordinates: [number, number]; type: "Point"; } | { coordinates: [number, number][]; type: "MultiPoint"; } | { coordinates: [number, number][]; type: "LineString"; } | { coordinates: [number, number][][]; type: "MultiLineString"; } | { coordinates: [number, number][][]; type: "Polygon"; } | { coordinates: [number, number][][][]; type: "MultiPolygon"; } | - |
feature.properties | { id: string; } & Partial<{ [key: string]: any; angleOfRepose?: number; appId?: string; arrowEnd?: boolean; arrowEndLength?: number; arrowEndYawn?: number; arrowStart?: boolean; arrowStartLength?: number; arrowStartYawn?: number; baseHeight?: number; bevel?: number; bevelSegments?: number; blockBasePoint?: boolean; blockId?: string; blockPropagation?: Record<string, "pass" | "force" | "stop">; borderColor?: string; borderRadius?: number; borderStyle?: | "solid" | "dotted" | "dashed" | "double" | "groove" | "ridge" | "inset" | "outset"; borderWidth?: number; boxShadow?: number; buildingID?: string; childFeatures?: Feature< | LineString | Polygon, { [name: string]: any; }>[]; circleText?: boolean; color?: string; content?: string; cornerRadius?: number; corners?: "fillet" | "chamfer"; cutAndFill?: boolean; cutAndFillOffset?: number; dendrogram?: DendroRoot; depth?: number; doesStack?: boolean; dwellingCount?: NumberKeyValueList; dwellingCountPerLevel?: boolean; dwellingMix?: NumberKeyValueList; dwellingParkingRequired?: NumberKeyValueList; dwellingPrice?: NumberKeyValueList; dwellingResidents?: NumberKeyValueList; dwellingSize?: NumberKeyValueList; efficiency?: number; elevationDatum?: number; fillOpacity?: number; floorToFloor?: number; flow?: RawSectionFlowProp; fromLayer?: string; gltf?: string; groupID?: string; guidelineOffset?: number; height?: number; hideBackground?: boolean; hideFloors?: boolean; hideVerticals?: boolean; id: string; imageUrl?: string; isDraped?: boolean; label?: string; labelColor?: string; layerId?: string; levels?: number; loft?: boolean; lotNumber?: string; marker?: Marker; markerAnchor?: | { label: "Right"; value: "bottom left"; } | { label: "Left"; value: "bottom right"; } | { label: "Center"; value: "bottom"; }; markerIcon?: string; maxWidth?: number; mirror?: boolean; noFacade?: boolean; offset?: number; offsetSide?: "right" | "left" | "both"; padding?: number; parkingProvided?: number; parkingRequired?: number; pavementWidth?: number; popup?: Record<string, any>; popupBorderColor?: string; popupBorderRadius?: number; popupBorderWidth?: number; popupColor?: string; popupContent?: string; popupHeight?: number; popupImg?: string; popupPadding?: number; popupWidth?: number; projectId: string; public: true; radius?: number; roadWidth?: number; rotation?: number; scale?: number; scenario?: string[]; sellEfficiency?: number; shiny?: boolean; slabThickness?: number; sourceFeatureProperties?: Record<string, any>; stackOrder?: number; stickColor?: string; stickHeight?: number; stickWidth?: number; stroke?: string; strokeDasharray?: number[]; strokeLinecap?: "butt" | "round" | "square"; strokeLinejoin?: "bevel" | "round" | "miter"; strokeOpacity?: number; strokeWidth?: number; textColor?: string; textSize?: number; topThickness?: number; type?: SectionType; usage?: string; visitorParkingRequired?: number; width?: number; }> | - |
Returns
void
Examples
typescript
// Update just a few properties on the selected section
const selected = await rpc.invoke("getSelectedFeatures");
const id = selected.features[0].properties.id;
await rpc.invoke("updateRawSection", [{
properties: {
id,
color: 'red',
usage: 'Residential',
levels: 2
}
}]);typescript
// Assign a flow to a section
await rpc.invoke("updateRawSection", [{
properties: {
id: 'section-id',
flow: { id: 'cd1e8657-c978-49ce-bb56-c68c6c5fdd95' }
}
}]);typescript
// Remove a property by passing null
await rpc.invoke("updateRawSection", [{
properties: { id: 'section-id', color: null }
}]);typescript
// Update geometry and properties together
await rpc.invoke("updateRawSection", [{
geometry: { type: 'Point', coordinates: [144.9631, -37.8136] },
properties: { id: 'section-id', name: 'Melbourne' }
}]);