Open jeffgaucho opened 6 years ago
just pushed a sample @ https://github.com/jeffgaucho/TWC-Esri/blob/master/upload_and_publish_from_geojson.py
I can publish with this perfectly. Do you know if the overwrite command works to update the feature layers? I cannot get it work overwrite the feature layer. I can definitely keep adding new feature layers fine, but looking for the best way to update things regularly and adding layer after layer may not be efficient.
it should overwrite the layer, but it will overwrite the entire layer. are you looking for a more intelligent way to update?
I am fine overwriting the entire layer, however it would be nice to keep the same properties (color schemes, etc). I cannot seem to do this, only create a new layer. But this would be problematic as the weather data are constantly changing/updating. The feature layer could be a geojson (a contour map) or an updated set of point based weather observations (in csv form).
http://ibmmain.maps.arcgis.com/sharing/rest/content/items/56d9e25ea8364588abf3665003251bec/data
This is an example of a feature layer I'd like to auto update
how, or where, are you setting the styling on the layer? are you creating a webmap, setting the style on the layer, then saving the webmap?
or are you setting the style directly on the layer?
I have not programmed/scripted any styling. Currently, it simply uploads/published the layer them I adjust things within AGOL. Im very open to changing this behavior but first just wanted content up there
@jeffgaucho i have noticed this as well in my testing. i'm going to try to find an answer on the official github repo for the python api @ https://github.com/Esri/arcgis-python-api. will tag it here when i log it.
I am trying to overwrite a feature layer but having issues. I am simply trying to overwrite the feature layer by updating the source .csv file. I can create a fresh feature layer, but the overwrite doesn't seem to work. Below is some python code I've been using.
My error is this : "RuntimeError: Service name 'Output' already exists for 'qYqXGubbNLHN3cEI'" The error is on: new_item_collection = FeatureLayerCollection.fromitem(new_item)
Also, I have used this esri link as guidance without success: https://developers.arcgis.com/python/sample-notebooks/overwriting-feature-layers/#Publish-the-cities-feature-layer-using-the-initial-dataset
Here's my code:
csv_path='output/PWSoutput'+ts+'.csv' csv_properties={'title':'Output','description':'Current Obs','tags':'twc,pws'} csv_item = gis.content.add(item_properties=csv_properties, data=csv_path) new_item = csv_item.publish() new_item.update(item_properties = csv_properties) new_item_collection = FeatureLayerCollection.fromitem(new_item) new_item_collection.manager.overwrite('PWSoutput'+ts+'.csv')