Closed egorbn closed 1 year ago
Update:
I found that the layerType property of the operational layer was, indeed, the issue.
I was able to find a workaround by setting the layer type explicitly in the item data and updating the WebMap item.
The additional code is:
wm1_item_text = wm1_item.get_data()
wm1_item_text["operationalLayers"][0]["layerType"]="ArcGISTiledImageServiceLayer"
wm1_item.update(item_properties={"text":json.dumps(wm1_item_text)})
A notebook with the workaround implemented showing the working method is here: https://github.com/egorbn/arcgis_api_python_testing/blob/main/webmap_text_property.ipynb
Although this workaround is usable, the above bug still stands. add_layer() should know how to set the proper layerType, or give information about why it can't, etc.
Overwriting and updating the text based item properties manually feels like a band-aid.
@egorbn I am working on a fix for this. The workaround seems to be good. But yes, we will get the API enhanced to support this. Thanks for reporting.
Thanks, @rhea-j ! Much appreciated. OK will use the WebMap.update() method for now.
This is being addressed for the next release :) Thank you for letting us know!
Describe the bug I am using ArcGIS API for Python to publish a local tiff raster to AGOL. I am then creating a local WebMap instance, adding the published raster item to this WebMap, and then saving this WebMap to AGOL. The issue is that the raster is not showing up in the WebMap. No errors or warning are raised in the code, but opening the WebMap in the Map Viewer in AGOL shows the following error message for the raster layer: "An error occurred loading this layer"
To Reproduce
Steps to reproduce the behavior: Python notebook with full steps to reproduce: https://github.com/egorbn/arcgis_api_python_testing/blob/main/raster_ops.ipynb
Screenshots Method 1:
Method 2:
Method 3:
Expected behavior The expected behavior is that the raster item is added to the WebMap and displayed automatically
Platform (please complete the following information):
Additional context