Select to view content in your preferred language

Problem publishing hosted tile layer from tile package using arcgis python api

12-18-2020 12:42 PM
New Contributor II


I have a python script that creates a local tile package from an ArcGIS Pro map project containing a single raster, then uploads it to ArcGIS Online (noaa geoplatform), and publishes it as a hosted tile layer. The script uses arcpy.CreateMapTilePackage_management() to create the local tile package (.tpkx), then it uploads to the geoplatform using arcgis.gis.content.add(). When attempting to publish() the item as a hosted tile layer, however, it triggers an error saying that 'file_type' must be provided. When I then use publish({}, file_type='tilePackage'), the hosted tile layer is created, but the tiles are not actually published (I have to publish the tiles manually in ArcGIS Online) and an Exception (No job id) is raised (see below).

I am using ArcGIS Pro 2.4, Python 3.6.12, arcgis 1.6.2.

Thanks in advance for any help you can provide.



Exception                                 Traceback (most recent call last)
<ipython-input-44-934c5d15bcf0> in <module>
---> 11         tile_package_item = test_tile_item.publish({}, file_type='tilePackage') 

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\ in publish(self, publish_parameters, address_fields, output_type, overwrite, file_type, build_initial_cache)
   8778             return Item(self._gis, ret[0]['serviceItemId'])
   8779         else:
-> 8780             serviceitem_id = self._check_publish_status(ret, folder)
   8781         return Item(self._gis, serviceitem_id)

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\ in _check_publish_status(self, ret, folder)
   9014                 raise Exception("No job results.")
   9015         else:
-> 9016             raise Exception("No job id")
   9018         return serviceitem_id

Exception: No job id



Tags (3)
0 Kudos
2 Replies
by Anonymous User
Not applicable

Hi Len,

Does it make any difference if you create a TPK file rather than a TPKX? What is the approximate size of this TPKX file that you are working with?

0 Kudos
New Contributor II

Hi Calvin,

No, it doesn't make any difference. I noticed that there is no 'compactTilePackage' file_type, so since in the publish() statement I'm using 'tilePackage' I tried creating a .tpk package file but still get the same result. The tile package is ~5 MB. When I publish the tiles manually in ArcGIS Online, it says it will need 191 MB but I guess that's staging space. The resulting hosted tile layer is also ~ 5 MB in size.



0 Kudos