UpdatePolygon
Updates existing Polygon objects resulting from a prior command or satisfying the specified constraints.
Parameters
ref and constraints are optional and are intersected when both are present. Scope warning: omitting all selectors targets every Polygon object. Always supply selectors for a scoped mutation.
Parameter | JSON type | Behavior |
|---|---|---|
array expression | Optional. No property filter; the command-specific selector requirement still applies. Filters existing objects using the constraints expression language. When ref is supplied it filters that referenced set. | |
string | Optional. When omitted, the existing label is unchanged. Sets the object’s label independently of user properties. | |
array of polygons, each an array of [x, y] numbers | Optional. Existing geometry is unchanged. Each polygon needs at least three two-coordinate vertices; coordinates must be finite. Replaces the entire geometry and recomputes area/bounds. Empty or invalid geometry fails. Overlapping component regions currently log a warning rather than being rejected. | |
object mapping property names to values | Optional. When omitted, existing user properties are unchanged except for keys listed in remove_props. Stores booleans, numbers, strings, supported arrays, or single-key _date, _blob, and _json wrappers. Bare null is rejected; property names and wrapped values are validated. See the properties reference for nested value rules. Replaces supplied property values without replacing the whole property map. | |
integer, 1 through 100000 | Optional. Select using the other supplied selectors; see the selection rule above. Uses an earlier compatible Polygon reference in this transaction; forward references, wrong types, and undeclared references are rejected. | |
array of strings | Optional. When omitted, no properties are removed. Removes named properties from selected objects; missing keys have no effect. A value also supplied in properties is stored after removal. |
Details
If the ref parameter is used, constraints will act as additional filters on the referenced result set.
If the ref parameter is specified, it must refer to the results of an earlier AddPolygon or FindPolygon within the transaction.
If the polygons parameter is present, the polygon regions will be replaced.
If the label parameter is present, the polygon’s labels will be replaced.
For more complex searches for objects to update, a Find command must be used first within the transaction.
Response and errors
An authenticated session is required. This command currently has no objects.update permission requirement. This is a known permission-mapping limitation; do not use that permission as an access boundary for this command.
The response is an object under UpdatePolygon with integer status and, on success, integer count. Status 0 means the mutation completed; count is the number of selected objects affected, including zero when none match. No output blobs are returned.
Invalid field types, missing required fields, malformed expressions, and invalid references fail validation. Execution failures include a nonzero status and an info message; inspect the transaction response before assuming a mutation succeeded.
Examples
Update the geometry of a specific polygon:
[{
"FindPolygon": {
"_ref": 1,
"constraints": ["$id", "==", 34],
"unique": true
}
}, {
"UpdatePolygon": {
"ref": 1,
"label": "Dog",
"polygons": [
[
[387.99, 176.5],
[398.34, 164.68],
[405.73, 156.55],
[412.38, 141.77],
[419.77, 136.6],
[424.94, 125.51],
[432.33, 116.64],
[434.55, 102.6],
[436.77, 97.43],
[441.94, 102.6],
[453.76, 101.12],
[459.68, 109.99],
[457.46, 115.9],
[463.37, 124.03],
[470.76, 128.47],
[472.98, 137.34],
[465.59, 143.25],
[447.11, 137.34],
[444.9, 142.51],
[442.68, 156.55],
[444.9, 163.2],
[446.37, 176.5],
[444.9, 178.72]
]
]
}
}]
Successful response:
[{
"FindPolygon": {
"returned": 0,
"status": 0
}
}, {
"UpdatePolygon": {
"count": 1,
"status": 0
}
}]
Update all polygons with the label “Person” to “People”, and remove any “label_type” properties:
[{
"UpdatePolygon": {
"constraints": ["$_label", "==", "Person"],
"label": "People",
"remove_props": ["label_type"]
}
}]
Successful response:
[{
"UpdatePolygon": {
"count": 1,
"status": 0
}
}]