Hi,
I've been trying to programmatically upload a scene layer package and eventually publish it as a scene layer. The idea is that my web scene will get updated layers frequently, so I need to automate uploading, publishing, and reediting the web scene.
My issue is that while trying this on the ArcGIS Pro Python console:
from arcgis.gis import GIS
gis = GIS("http://esrimsia.maps.arcgis.com", "xxxx", "xxxxx")
slpk_path = r"D:\Documents\ArcGIS\Projects\MMD\Rainfall_pointsample_few.slpk"
slpk_properties={'title':'rainfall_test', 'description':'rainfall test', 'tags':'test', 'type':'Scene Package'}
rainfall_item = gis.content.add(item_properties=slpk_properties, data=slpk_path)
rainfall_item.publish()
At the publish statement, I got the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis.py", line 2818, in publish elif fileType == 'CSV':
UnboundLocalError: local variable 'fileType' referenced before assignment
What's the best way to tackle this issue?
Regards,
Ken Moey
Min, could you verify you are using the 1.0.1 version of the API?
Could you also paste the full traceback, it would be easier to debug.
Hi Atma Maini,
I was trying it on ArcGIS Pro, so the version says it's 0.3 of the ArcGIS API for Python. It's the latest one i just downloaded.
That is the full traceback that i got.
Thanks Min, please remove or mask that picture you posted as it accidentally has your credentials.
The ability to publish packages as web layers was added to version 1.0. Could you please update the package following these instructions and then try again?
Hi Atma Mani,
Alright that worked. I could publish it now. However, when i try to view the web scene which i published using ArcGIS API for Python, i get the error:
Regards,
Ken Moey
Min, since you are publishing to ArcGIS Online, we put a check where you need to visit the item (in the browser) and publish the tiles as a second step. This exists only on ArcGIS Online and not on Portal for ArcGIS since this step consumes some credits. We are evaluating a couple of different ways to address this issue.
Hi Atma Mani,
Ok, so if i was publishing to Portal, it theoretically can work. Publishing to Portal is my ultimate use case actually. Thanks for your help.
Thanks, MIn Ken