- URL:
- https://<LinearReferencingService-url>/applyEdits
- Methods:
POST
- Required Capability:
- Event Editing, Network Editing
- Version Introduced:
- 10.6
Description
This operation applies a batch of event or route changes to the editable linear referencing layers in the service.
Currently, only point and linear event layers, network (route) layers, and calibration point layers can be edited.
Edits can only be applied to event feature classes that are local to the LRS geodatabase. External event tables are treated as read-only data sources and do not support web editing.
All edits sent in one request are applied in a single database transaction to maintain data integrity. If any of the individual edits fail, the entire transaction is rolled back and none of the changes are applied. An edit operation can only include layers that exist in a single database workspace. An error message is returned if an edit request specifies layers defined in different workspaces.
Request parameters
Parameter | Details |
---|---|
(Optional) |
Specifies the response format. The default response format is Values: |
(Required) | A batch of changes to apply to the editable layers in the service. Each layer can receive a distinct set of additions, updates, and deletions. The format of the change records depends on the layer type being edited.
|
|
Specifies the geodatabase version to use. If this parameter is not specified, the published map's version is used. Syntax:
Example:
|
|
Specifies whether the response reports the time edits that were applied. If Values: |
|
Set by a client during long transaction editing on a branch version. The Syntax:
Example:
|
|
Returns features edited due to the geodatabase behavior that results from applying the edits. For example, if a feature is deleted and it is the origin in a composite relationship, the destination feature is automatically deleted from the geodatabase. If Results returned from Service-level
The
The response includes no Edited features are returned in the spatial reference of the feature service as defined by the services The default value is Values: |
Example usage
The following examples demonstrate how to add events to an event layer.
Example 1
A URL for adding new events to a point event layer is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":1,"adds":[{"attributes":{"route_id":"I90","event_id":"ABC123","meas":48.5}}]}]
Example 2
A URL for adding new events to a linear event layer is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":2,"adds":[{"attributes":{"RouteID":"US101","EventID":"ABC123","FromMeasure":20,"ToMeasure":25.75}}]}]
Example 3
A URL for adding new events with a temporal view date range is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":3,"adds":[{"attributes":{"ROUTEID":"SR85","EVENTID":"ABC123","MEAS":35,"FROM_DATE":1230768000000,"TO_DATE":1262304000000}}]}]
Example 4
A URL for adding new events with measure merging is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":2,"allowMerge":true,"adds":[{"attributes":{"RouteID":"US101","EventID":"ABC123","Pavement":"concrete","FromMeasure":20,"ToMeasure":25.75}}]}]
Example 5
A URL for adding new events with measure overlap retirement is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":2,"retireMeasureOverlap":true,"adds":[{"attributes":{"RouteID":"US101","EventID":"ABC123","FromMeasure":20,"ToMeasure":25.75}}]}]
Example 6
A URL for adding new events with referent locations is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":2,"allowMerge":true,"retireMeasureOverlap":true,"adds":[{"attributes":{"RouteID":"US101","EventID":"ABC123","SpeedLimit":65,"FromMeasure":20,"ToMeasure":25.75,"FromRefMethod":12,"FromRefLocation":"{E9A2157D-DFD5-4696-943F-B35DD77C0BBE}","FromRefOffset":"125","ToRefMethod":20,"ToRefLocation":"{C061ECEC-C0BA-462D-BB73-DA175EAEFBD2}","ToRefOffset":"-50.3"}}]}]
Example 7
A URL for updating events using a WHERE
clause is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":2,"updates":[{"where":"Pavement = 'asphalt' and LaneCount = 2","attributes":{"LastPaved":1262304000000}}]}]
Example 8
A URL for updating events by event ID is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":2,"updates":[{"eventId":"ABC123","attributes":{"FromMeasure":42.5,"ToDate":null}}]}]
Example 9
A URL for deleting events using a WHERE
clause is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":2,"deletes":[{"where":"RouteType = 'IN' and LaneCount < 3"}]}]
Example 10
A URL for deleting events by event ID is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":4,"deletes":[{"eventId":500},{"eventId":501}]},{"id":1,"deletes":[{"eventId":"ABC123"}]}]
Example 11
A URL for adding calibration points is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id": 0, "addCalibrationPoints": [{ "networkLayerId": 2, "routeId": "US101", "fromDate": 1520318060000, "geometry": { "x":34, "y": 117}, "measure": 101 }] }]
Example 12
A URL for updating calibration points is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id": 0, "updateCalibrationPoints": [{ "objectId": 777, measure: 107 }] }]
Example 13
A URL for deleting calibration points is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":0,"deleteCalibrationPoints":[{"objectId":777}]}]
Example 14
A URL for splitting a centerline is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":7,"splitCenterline":{"objectId":14166,"geometry":{"x":1276002.55695067,"y":12351516.6711279},"spatialReference":{"wkid":102013}}}]
Example 15
A URL for splitting centerlines into singlepart features is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":7,"splitCenterlinesIntoSingleparts":{"objectIds":[14166,14177]}}]
Example 16
A URL for splitting an event is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":2,"splitEvent":{"objectId":4801,"routeId":"{78F14930-E693-45A9-B895-6595932E5650}","measure":255.16499999999999,"fromDate":1651536000000,"toDate":253402300799999,"attributes":{"dblField":1,"NotNull":2},"attributes2":{"dblField":null,"NotNull":4}}}]
Example 17
A URL for merging two events is shown.
https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/applyEdits?f=json&edits=[{"id":2,"mergeEvents":{"objectIds":[4801,4802],"objectIdToPreserve":4801,"fromDate":1651536000000,"toDate":253402300799999,"attributes":{"dblField":1,"NotNull":2}}}]
JSON Response syntax
Example of a successful response
{
"success": true
}
If an error occurs, the operation fails and rolls back, for example, if any line (or route) that is being edited has a lock.
{
"error": { "code": <errorCode>, "message": "<errorMessage>" },
"missingLocks": {
{"networkId": "<networkId>", "routeId": "<routeId>"},
{"networkId": "<networkId>", "lineId": "<lineId>"}, ...}
}
Example of a successful split centerline response
{
"objectIds": [newCenterlineOID1, newCenterlineOID2, ...]
}
Example of a successful split event or merge events response
{
"objectIds": [newEventOID1, newEventOID2, ...]
}