<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic arcgis append hosted feature layer. &amp;quot;Job Failed&amp;quot; error in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcgis-append-hosted-feature-layer-quot-job-failed/m-p/1116614#M42966</link>
    <description>&lt;P&gt;I am trying to get this zip file I generated to update data -&amp;gt; append data to layer. If I manually download the zip file I generated and manually go in and append data to layer it works exactly how I want it. The problem is my python code, which I admit I am new to.&lt;/P&gt;&lt;P&gt;&lt;A href="https://Olansi.net/" target="_self"&gt;I&lt;/A&gt; want to make sure I am appending data to my layer aka doing what I did manually on python. I tried to code based on a tutorial I watched and I am getting an error which I cannot figure out. I am not sure if what I have would completely replace the layer or just add new data (which is what I am trying to accomplish)&lt;/P&gt;&lt;P&gt;Attached is my code with a photo of the error I get:&lt;/P&gt;&lt;P&gt;from arcgis.gis import GIS&lt;BR /&gt;from arcgis.features import FeatureLayerCollection&lt;BR /&gt;import requests&lt;BR /&gt;import urllib.request&lt;BR /&gt;from zipfile import ZipFile&lt;BR /&gt;import xarray as xr&lt;BR /&gt;import matplotlib&lt;BR /&gt;import matplotlib.pyplot as plt&lt;BR /&gt;import metpy.calc as mpcalc&lt;BR /&gt;from metpy.units import units&lt;BR /&gt;from shapely import geometry&lt;BR /&gt;import numpy as np&lt;BR /&gt;import fiona&lt;/P&gt;&lt;P&gt;#Load data&lt;BR /&gt;#urllib.request.urlretrieve('rap.t00z.awp130pgrbf00.grib2', 'a.grib2')&lt;/P&gt;&lt;P&gt;# Open data file &amp;amp; read data&lt;BR /&gt;ds = xr.open_dataset('rap.t23z.awp252pgrbf00.grib2', engine='cfgrib')&lt;BR /&gt;lon, lat = ds.longitude.values-360., ds.latitude.values&lt;BR /&gt;t2m = mpcalc.smooth_gaussian((ds.variables['t2m'].values*units('K')).to('degF').magnitude, 4)&lt;/P&gt;&lt;P&gt;# Plot&lt;BR /&gt;fig = plt.figure(figsize=(12,10))&lt;BR /&gt;ax = fig.add_subplot(111)&lt;BR /&gt;cs = ax.contourf(lon, lat, t2m, levels=[10,20,30,32,36]) ## EDIT CONTOUR LEVELS HERE&lt;BR /&gt;#plt.close()&lt;BR /&gt;#plt.show()&lt;/P&gt;&lt;P&gt;# Write contours to shapefile&lt;BR /&gt;lvl_lookup = dict(zip(cs.collections, cs.levels))&lt;BR /&gt;PolyList=[]&lt;BR /&gt;for col in cs.collections:&lt;BR /&gt;z = lvl_lookup[col] # the value of this level&lt;BR /&gt;for contour_path in col.get_paths():&lt;BR /&gt;# create the polygon for this level&lt;BR /&gt;for ncp,cp in enumerate(contour_path.to_polygons()):&lt;BR /&gt;lons = cp[:,0]&lt;BR /&gt;lats = cp[:,1]&lt;BR /&gt;new_shape = geometry.Polygon([(i[0], i[1]) for i in zip(lons,lats)])&lt;BR /&gt;if ncp == 0:&lt;BR /&gt;poly = new_shape # first shape&lt;BR /&gt;else:&lt;BR /&gt;poly = poly.difference(new_shape) # Remove the holes&lt;BR /&gt;&lt;BR /&gt;PolyList.append({'poly':poly,'props':{'z': z}})&lt;BR /&gt;schema = {'geometry': 'Polygon','properties': {'z': 'float'}}&lt;BR /&gt;crs = {'no_defs': True, 'ellps': 'WGS84', 'datum': 'WGS84', 'proj': 'longlat'}&lt;BR /&gt;with fiona.collection('rap_temp.shp', 'w', driver='ESRI Shapefile', crs=crs, schema=schema) as output:&lt;BR /&gt;for p in PolyList:&lt;BR /&gt;output.write({'properties': p['props'],&lt;BR /&gt;'geometry': geometry.mapping(p['poly'])})&lt;BR /&gt;&lt;BR /&gt;# create a ZipFile object&lt;BR /&gt;rap_temp = ZipFile('rap_temp2.zip', 'w')&lt;BR /&gt;# Add multiple files to the zip&lt;BR /&gt;rap_temp.write('rap_temp.cpg')&lt;BR /&gt;rap_temp.write('rap_temp.dbf')&lt;BR /&gt;rap_temp.write('rap_temp.prj')&lt;BR /&gt;rap_temp.write('rap_temp.shp')&lt;BR /&gt;rap_temp.write('rap_temp.shx')&lt;BR /&gt;#Close the zip file&lt;BR /&gt;rap_temp.close()&lt;/P&gt;&lt;P&gt;# ARC GIS&lt;/P&gt;&lt;P&gt;#Login&lt;BR /&gt;user = '****'&lt;BR /&gt;password = '****'&lt;BR /&gt;gis = GIS('&lt;A href="https://rvhlcps.maps.arcgis.com" target="_blank"&gt;https://rvhlcps.maps.arcgis.com&lt;/A&gt;', user, password)&lt;BR /&gt;un = gis.properties.user.username&lt;BR /&gt;print('Logged in as: {}'.format(un))&lt;/P&gt;&lt;P&gt;#overwrite layer with new data&lt;BR /&gt;itemid = '41b06ab534504b388c17b89c04bc0eef'&lt;BR /&gt;dataitem = gis.content.get(itemid)&lt;BR /&gt;print('1')&lt;BR /&gt;flayercol = FeatureLayerCollection.fromitem(dataitem)&lt;BR /&gt;print('2')&lt;BR /&gt;flayercol.manager.overwrite('rap_temp2.zip')&lt;BR /&gt;print('Layer Updated')&lt;BR /&gt;Here is the error:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;---------------------------------------------------------------------------&lt;BR /&gt;Exception Traceback (most recent call last)&lt;BR /&gt;&amp;lt;ipython-input-2-2dc8c4b4cf39&amp;gt; in &amp;lt;module&amp;gt;&lt;BR /&gt;14 flayercol = FeatureLayerCollection.fromitem(dataitem)&lt;BR /&gt;15 print('2')&lt;BR /&gt;---&amp;gt; 16 flayercol.manager.overwrite('rap_temp2.zip')&lt;BR /&gt;17 print('Layer Updated')&lt;/P&gt;&lt;P&gt;/opt/tljh/user/lib/python3.7/site-packages/arcgis/features/managers.py in overwrite(self, data_file)&lt;BR /&gt;2269 if related_data_item.update(item_properties=params, data=data_file):&lt;BR /&gt;2270 published_item = related_data_item.publish(&lt;BR /&gt;-&amp;gt; 2271 publish_parameters, overwrite=True&lt;BR /&gt;2272 )&lt;BR /&gt;2273 if published_item is not None:&lt;/P&gt;&lt;P&gt;/opt/tljh/user/lib/python3.7/site-packages/arcgis/gis/__init__.py in publish(self, publish_parameters, address_fields, output_type, overwrite, file_type, build_initial_cache, item_id, geocode_service)&lt;BR /&gt;12741 return Item(self._gis, ret[0]["serviceItemId"])&lt;BR /&gt;12742 else:&lt;BR /&gt;&amp;gt; 12743 serviceitem_id = self._check_publish_status(ret, folder)&lt;BR /&gt;12744 return Item(self._gis, serviceitem_id)&lt;BR /&gt;12745&lt;/P&gt;&lt;P&gt;/opt/tljh/user/lib/python3.7/site-packages/arcgis/gis/__init__.py in _check_publish_status(self, ret, folder)&lt;BR /&gt;13091 # print(str(job_response))&lt;BR /&gt;13092 if job_response.get("status") in ("esriJobFailed", "failed"):&lt;BR /&gt;&amp;gt; 13093 raise Exception("Job failed.")&lt;BR /&gt;13094 elif job_response.get("status") == "esriJobCancelled":&lt;BR /&gt;13095 raise Exception("Job cancelled.")&lt;/P&gt;&lt;P&gt;Exception: Job failed.&lt;/P&gt;</description>
    <pubDate>Sat, 13 Nov 2021 13:48:24 GMT</pubDate>
    <dc:creator>AmmirKhan</dc:creator>
    <dc:date>2021-11-13T13:48:24Z</dc:date>
    <item>
      <title>arcgis append hosted feature layer. "Job Failed" error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcgis-append-hosted-feature-layer-quot-job-failed/m-p/1116614#M42966</link>
      <description>&lt;P&gt;I am trying to get this zip file I generated to update data -&amp;gt; append data to layer. If I manually download the zip file I generated and manually go in and append data to layer it works exactly how I want it. The problem is my python code, which I admit I am new to.&lt;/P&gt;&lt;P&gt;&lt;A href="https://Olansi.net/" target="_self"&gt;I&lt;/A&gt; want to make sure I am appending data to my layer aka doing what I did manually on python. I tried to code based on a tutorial I watched and I am getting an error which I cannot figure out. I am not sure if what I have would completely replace the layer or just add new data (which is what I am trying to accomplish)&lt;/P&gt;&lt;P&gt;Attached is my code with a photo of the error I get:&lt;/P&gt;&lt;P&gt;from arcgis.gis import GIS&lt;BR /&gt;from arcgis.features import FeatureLayerCollection&lt;BR /&gt;import requests&lt;BR /&gt;import urllib.request&lt;BR /&gt;from zipfile import ZipFile&lt;BR /&gt;import xarray as xr&lt;BR /&gt;import matplotlib&lt;BR /&gt;import matplotlib.pyplot as plt&lt;BR /&gt;import metpy.calc as mpcalc&lt;BR /&gt;from metpy.units import units&lt;BR /&gt;from shapely import geometry&lt;BR /&gt;import numpy as np&lt;BR /&gt;import fiona&lt;/P&gt;&lt;P&gt;#Load data&lt;BR /&gt;#urllib.request.urlretrieve('rap.t00z.awp130pgrbf00.grib2', 'a.grib2')&lt;/P&gt;&lt;P&gt;# Open data file &amp;amp; read data&lt;BR /&gt;ds = xr.open_dataset('rap.t23z.awp252pgrbf00.grib2', engine='cfgrib')&lt;BR /&gt;lon, lat = ds.longitude.values-360., ds.latitude.values&lt;BR /&gt;t2m = mpcalc.smooth_gaussian((ds.variables['t2m'].values*units('K')).to('degF').magnitude, 4)&lt;/P&gt;&lt;P&gt;# Plot&lt;BR /&gt;fig = plt.figure(figsize=(12,10))&lt;BR /&gt;ax = fig.add_subplot(111)&lt;BR /&gt;cs = ax.contourf(lon, lat, t2m, levels=[10,20,30,32,36]) ## EDIT CONTOUR LEVELS HERE&lt;BR /&gt;#plt.close()&lt;BR /&gt;#plt.show()&lt;/P&gt;&lt;P&gt;# Write contours to shapefile&lt;BR /&gt;lvl_lookup = dict(zip(cs.collections, cs.levels))&lt;BR /&gt;PolyList=[]&lt;BR /&gt;for col in cs.collections:&lt;BR /&gt;z = lvl_lookup[col] # the value of this level&lt;BR /&gt;for contour_path in col.get_paths():&lt;BR /&gt;# create the polygon for this level&lt;BR /&gt;for ncp,cp in enumerate(contour_path.to_polygons()):&lt;BR /&gt;lons = cp[:,0]&lt;BR /&gt;lats = cp[:,1]&lt;BR /&gt;new_shape = geometry.Polygon([(i[0], i[1]) for i in zip(lons,lats)])&lt;BR /&gt;if ncp == 0:&lt;BR /&gt;poly = new_shape # first shape&lt;BR /&gt;else:&lt;BR /&gt;poly = poly.difference(new_shape) # Remove the holes&lt;BR /&gt;&lt;BR /&gt;PolyList.append({'poly':poly,'props':{'z': z}})&lt;BR /&gt;schema = {'geometry': 'Polygon','properties': {'z': 'float'}}&lt;BR /&gt;crs = {'no_defs': True, 'ellps': 'WGS84', 'datum': 'WGS84', 'proj': 'longlat'}&lt;BR /&gt;with fiona.collection('rap_temp.shp', 'w', driver='ESRI Shapefile', crs=crs, schema=schema) as output:&lt;BR /&gt;for p in PolyList:&lt;BR /&gt;output.write({'properties': p['props'],&lt;BR /&gt;'geometry': geometry.mapping(p['poly'])})&lt;BR /&gt;&lt;BR /&gt;# create a ZipFile object&lt;BR /&gt;rap_temp = ZipFile('rap_temp2.zip', 'w')&lt;BR /&gt;# Add multiple files to the zip&lt;BR /&gt;rap_temp.write('rap_temp.cpg')&lt;BR /&gt;rap_temp.write('rap_temp.dbf')&lt;BR /&gt;rap_temp.write('rap_temp.prj')&lt;BR /&gt;rap_temp.write('rap_temp.shp')&lt;BR /&gt;rap_temp.write('rap_temp.shx')&lt;BR /&gt;#Close the zip file&lt;BR /&gt;rap_temp.close()&lt;/P&gt;&lt;P&gt;# ARC GIS&lt;/P&gt;&lt;P&gt;#Login&lt;BR /&gt;user = '****'&lt;BR /&gt;password = '****'&lt;BR /&gt;gis = GIS('&lt;A href="https://rvhlcps.maps.arcgis.com" target="_blank"&gt;https://rvhlcps.maps.arcgis.com&lt;/A&gt;', user, password)&lt;BR /&gt;un = gis.properties.user.username&lt;BR /&gt;print('Logged in as: {}'.format(un))&lt;/P&gt;&lt;P&gt;#overwrite layer with new data&lt;BR /&gt;itemid = '41b06ab534504b388c17b89c04bc0eef'&lt;BR /&gt;dataitem = gis.content.get(itemid)&lt;BR /&gt;print('1')&lt;BR /&gt;flayercol = FeatureLayerCollection.fromitem(dataitem)&lt;BR /&gt;print('2')&lt;BR /&gt;flayercol.manager.overwrite('rap_temp2.zip')&lt;BR /&gt;print('Layer Updated')&lt;BR /&gt;Here is the error:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;---------------------------------------------------------------------------&lt;BR /&gt;Exception Traceback (most recent call last)&lt;BR /&gt;&amp;lt;ipython-input-2-2dc8c4b4cf39&amp;gt; in &amp;lt;module&amp;gt;&lt;BR /&gt;14 flayercol = FeatureLayerCollection.fromitem(dataitem)&lt;BR /&gt;15 print('2')&lt;BR /&gt;---&amp;gt; 16 flayercol.manager.overwrite('rap_temp2.zip')&lt;BR /&gt;17 print('Layer Updated')&lt;/P&gt;&lt;P&gt;/opt/tljh/user/lib/python3.7/site-packages/arcgis/features/managers.py in overwrite(self, data_file)&lt;BR /&gt;2269 if related_data_item.update(item_properties=params, data=data_file):&lt;BR /&gt;2270 published_item = related_data_item.publish(&lt;BR /&gt;-&amp;gt; 2271 publish_parameters, overwrite=True&lt;BR /&gt;2272 )&lt;BR /&gt;2273 if published_item is not None:&lt;/P&gt;&lt;P&gt;/opt/tljh/user/lib/python3.7/site-packages/arcgis/gis/__init__.py in publish(self, publish_parameters, address_fields, output_type, overwrite, file_type, build_initial_cache, item_id, geocode_service)&lt;BR /&gt;12741 return Item(self._gis, ret[0]["serviceItemId"])&lt;BR /&gt;12742 else:&lt;BR /&gt;&amp;gt; 12743 serviceitem_id = self._check_publish_status(ret, folder)&lt;BR /&gt;12744 return Item(self._gis, serviceitem_id)&lt;BR /&gt;12745&lt;/P&gt;&lt;P&gt;/opt/tljh/user/lib/python3.7/site-packages/arcgis/gis/__init__.py in _check_publish_status(self, ret, folder)&lt;BR /&gt;13091 # print(str(job_response))&lt;BR /&gt;13092 if job_response.get("status") in ("esriJobFailed", "failed"):&lt;BR /&gt;&amp;gt; 13093 raise Exception("Job failed.")&lt;BR /&gt;13094 elif job_response.get("status") == "esriJobCancelled":&lt;BR /&gt;13095 raise Exception("Job cancelled.")&lt;/P&gt;&lt;P&gt;Exception: Job failed.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Nov 2021 13:48:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcgis-append-hosted-feature-layer-quot-job-failed/m-p/1116614#M42966</guid>
      <dc:creator>AmmirKhan</dc:creator>
      <dc:date>2021-11-13T13:48:24Z</dc:date>
    </item>
  </channel>
</rss>

