Error when trying to generate offline areas

02-12-2020 06:10 PM
New Contributor III

I'm attempting to automate the creation of a set of offline areas from a AGOL web map. I've created a couple of areas for this web map manually through AGOL with no problem. However, when attempting this with the Python API, I'm getting errors. My web map is very simple and only contains a vector basemap.

Any ideas on the source of this error?

In the example below, I use a bookmark for the area, but the same error occurs if I use an extent.

Using this command:

offlineItem = oWebMap.offline_areas.create(area='TAE', item_properties=oLine_properties)


The bookmark itself:
{ "extent": { "spatialReference": { "wkid": 102100 }, "xmax": -9311960.288686637, "xmin": -9457037.768371958, "ymax": 3644687.9398760623, "ymin": 3470105.7672726526 }, "name": "TAE"

oLine_properties = {'title': 'TAE1',
'tags': ['DAT'],
'snippet': 'Offline Map for TAE CWA'}

The error:

{"code": 24, "messageCode": "OffPkg_ 24", "message": "Parameter extent is invalid or exceeded limit.", "params": {"name": "extent"}} Failed to execute (CreateMapArea). Failed.
Submitted. Executing... Start Time: Thursday, February 13, 2020 2:06:55 AM Running script CreateMapArea... {"code": 24, "messageCode": "OffPkg_ 24", "message": "Parameter extent is invalid or exceeded limit.", "params": {"name": "extent"}} Completed script CreateMapArea... Failed to execute (CreateMapArea). Failed at Thursday, February 13, 2020 2:06:55 AM (Elapsed Time: 0.15 seconds) Failed.
---------------------------------------------------------------------------Exception                                 Traceback (most recent call last)<ipython-input-55-699c796e29ec> in <module>----> 1 offlineItem = oWebMap.offline_areas.create(area='TAE', item_properties=oLine_properties)~/opt/anaconda3/lib/python3.7/site-packages/arcgis/mapping/ in create(self, area, item_properties, folder, min_scale, max_scale, layers_to_ignore, refresh_schedule, refresh_rates)   1269         from arcgis.geoprocessing._tool import Toolbox   1270         pkg_tb = Toolbox(url=self._url, gis=self._gis)-> 1271         oma_result = pkg_tb.create_map_area(, _bookmark, _extent, output_name=output_name)   1272         # endregion   1273  ~/opt/anaconda3/lib/python3.7/site-packages/arcgis/geoprocessing/ in create_map_area(self, map_item_id, bookmark, extent, area_type, area, output_name)    101         #    print(k + " => " + str(v))    102 --> 103         return self._execute(kwargs)    104     105     code = call.__code__ ~/opt/anaconda3/lib/python3.7/site-packages/arcgis/geoprocessing/ in _execute(self, params)   1004             try:   1005                 isCan = False-> 1006                 job_info = super()._analysis_job_status(task_url, job_info)   1007             except KeyboardInterrupt:   1008                 cancel_url = "%s/jobs/%s/cancel" % (task_url, job_info['jobId'])~/opt/anaconda3/lib/python3.7/site-packages/arcgis/geoprocessing/ in _analysis_job_status(self, task_url, job_info)    505     506                     if job_response.get("jobStatus") == "esriJobFailed":--> 507                         raise Exception("Job failed.")    508                     elif job_response.get("jobStatus") == "esriJobCancelled":    509                         raise Exception("Job cancelled.")Exception: Job failed.
0 Kudos
1 Reply
New Contributor

I'm having the same issue when attempting to create an offline area from an extent and a bookmark.  I'm getting the following error message.  I've imported the mapping and geometry packages but that didn't fix it.

NameError Traceback (most recent call last)
In [11]:
Line 1: offline_item = webmap.offline_areas.create(area = webmap.definition.bookmarks[0].name, item_properties = offline_item_properties, min_scale=16000, max_scale=100000)

File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\mapping\, in create:
Line 1296: elif isinstance(area, Envelope) or \

NameError: name 'Envelope' is not defined

0 Kudos