I have a couple of hardware GPS trackers which we install on vehicles. The gps points from these trackers arrive on one of my servers, from where I want to push the locations into Arcgis Online.
I have tried this piece of Python code to append a track point to the track layer:
gis = GIS(username="redacted", password="redacted")
izinto_item = gis.content.get("redated")
feature_layer = izinto_item.layers[1]
new_feature = {"geometry": {"x": redacted, "y": redacted, "spatialReference": {"wkid": 4326, "latestWkid": 4326}}, "attributes": {"activity": 0, "altitude": 511.228589377366, "app_id": "izinto", "battery_percentage": 55, "battery_state": 1, "course": None, "device_id": "test", "floor": None, "horizontal_accuracy": 46.4931761266777, "location_source": None, "location_timestamp": 1636544141380, "session_id": "test", "signal_strength": None, "speed": 0.646095156669617, "vertical_accuracy": 7.64551688182702, "full_name": "redacted", "category": None, "created_user": "redacted", "created_date": 1636544328798, "last_edited_user": "redacted", "last_edited_date": 1636544328798}}
feature_layer.edit_features(adds=[new_feature])
Running this code however results in an error:
Traceback (most recent call last):
File "/home/jpmeijers/PycharmProjects/arcgis-update-feature/track.py", line 52, in <module>
main()
File "/home/jpmeijers/PycharmProjects/arcgis-update-feature/track.py", line 48, in main
feature_layer.edit_features(adds=[new_feature])
File "/home/jpmeijers/PycharmProjects/arcgis-update-feature/venv/lib/python3.8/site-packages/arcgis/features/layer.py", line 2827, in edit_features
return self._con.post_multipart(path=edit_url, postdata=params)
File "/home/jpmeijers/PycharmProjects/arcgis-update-feature/venv/lib/python3.8/site-packages/arcgis/gis/_impl/_con/_connection.py", line 863, in post_multipart
return self._handle_response(
File "/home/jpmeijers/PycharmProjects/arcgis-update-feature/venv/lib/python3.8/site-packages/arcgis/gis/_impl/_con/_connection.py", line 625, in _handle_response
self._handle_json_error(data["error"], errorcode)
File "/home/jpmeijers/PycharmProjects/arcgis-update-feature/venv/lib/python3.8/site-packages/arcgis/gis/_impl/_con/_connection.py", line 648, in _handle_json_error
raise Exception(errormessage)
Exception:
This operation is not supported.
(Error Code: 400)
Process finished with exit code 1
What would be the proper way to upload GPS tracks that are obtained from a hardware GPS tracker device?