Hello Community,
i've got a Problem with Uploading Rasterimages to the ESRI Portal with Python.
For Feature Layer everything is working well with e.g.
.
.
layerproperties['type'] = 'Shapefile'
item = self.gis.content.add(item_properties=layerproperties, data=layerpath)
item.publish()
But if i try to upload a .tif in a .zip and change the 'type' to 'Image Collection' i get a Problem after the Upload when i try to publish:
ValueError: A file_type must be provide, data format not recognized
I tried to publish the Image Collection manually in the portal:
Publish Image Collection error: Exception: null
After that i watched into the Reference and chnanged item.publish() to:
item.publish(publish_parameters=None, address_fields=None, output_type=None, overwrite=False, file_type='Image Collection' , build_initial_cache=False, item_id=None)
ErrorMessage:
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\arcgis\gis\__init__.py", line 10353, in publish
elif not buildInitialCache and ret[0]['type'].lower() == 'image service':
KeyError: 'type'
So i added a output_type to the publish function:
item.publish(publish_parameters=None, address_fields=None, output_type='Imagery Layer', overwrite=False, file_type='Image Collection' , build_initial_cache=False, item_id=None)
I got the same error.
So i watched again in the reference:
Publishes a hosted service based on an existing source item (this item). Publishers can create feature, tiled map, vector tile and scene services.
Feature services can be created using input files of type csv, shapefile, serviceDefinition, featureCollection, and fileGeodatabase. CSV files that contain location fields (i.e. address fields or XY fields) are spatially enabled during the process of publishing. Shapefiles and file geodatabases should be packaged as *.zip files.
Tiled map services can be created from service definition (*.sd) files, tile packages, and existing feature services.
Vector tile services can be created from vector tile package (*.vtpk) files.
Scene services can be created from scene layer package (*.spk, *.slpk) files.
Service definitions are authored in ArcGIS Pro or ArcGIS Desktop and contain both the cartographic definition for a map as well as its packaged data together with the definition of the geo-service to be created.
Seems for me, i cant upload and publish any images...
Am i right? Or does anyone know how to solve the problem?
Best regards and thanks a lot for your help