Skip to main content

UpdatePolygon

Updates existing Polygon objects resulting from a prior command or satisfying the specified constraints.

Parameters

Details

If the ref parameter is used, constraints will be ignored.

If the ref parameter is specified, it must refers to the search results of a previous 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.

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
}
}]