Error when trying to generate offline areas

1455
3
02-12-2020 06:10 PM
ParksCamp
Regular Contributor

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)

where:

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/_types.py 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(self._item.id, _bookmark, _extent, output_name=output_name)   1272         # endregion   1273  ~/opt/anaconda3/lib/python3.7/site-packages/arcgis/geoprocessing/_tool.py 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/_tool.py 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/_tool.py 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
3 Replies
LauraRoghair
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\_types.py, in create:
Line 1296: elif isinstance(area, Envelope) or \

NameError: name 'Envelope' is not defined
---------------------------------------------------------

0 Kudos
cschooley
Occasional Contributor

I know this is an old post, but I too am having this issue. 

{"code": 24, "messageCode": "OffPkg_ 24", "message": "Parameter extent is invalid or exceeded limit.", "params": {"name": "extent"}}
Failed to execute (CreateMapArea).
Failed.

Anything new here ESRI?

0 Kudos
ChristopherCounsell
MVP Regular Contributor

I came across this issue and found it was tied to the polygon complexity. There were either geometry errors or too many vertices in the feature itself. Simpler polygons in the same layer worked while larger/complex ones did not.

I ran the generalize tool on the polygon layer to smooth them out and the error disappeared.

0 Kudos