Spatial join and attribute join failing since latest AGOL update

03-22-2019 04:55 PM
Occasional Contributor

I have a Py API script running nightly that does a spatial join of wildlife observations to a Township grid. Since Wednesday morning, this script has been failing (error messages below). I have also tried replacing the spatial join with just an attribute join (using code a month ago that was working then) and this too is failing. Then I tried do these two joins manually in a webmap and those jobs also failed. Any ideas of what is happening? Bug in AGOL update that affected the API?

Jupyter error on spatial join:

Now spatial-joining (intersecting) obs layer to reference layer...
{"messageCode": "AO_100215", "message": "JoinFeatures failed."} Failed to execute (JoinFeatures). Failed.

Py script error on spatial join:

   flcJoinResult = join_features(target_layer, join_layer,spatial_relationship='intersects',spatial_relationship_distance=None, spatial_relationship_distance_units=None, attribute_relationship=None, join_operation='JoinOneToMany', summary_fields=None, output_name=new_fs_name, context=None, gis=None)

File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\", line 305, in join_features


File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\", line 1071, in join_features

   job_info = super()._analysis_job_status(task_url, job_info)

File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\", line 188, in _analysis_job_status

   raise Exception("Job failed.")

Exception: Job failed.

Spatial join failed in webmap too

Tags (2)
0 Kudos
2 Replies
Occasional Contributor

Update: I think the problem might be related to using a View of the hosted features service rather than the HFS itself. However, the View was working before, so I'm still unsure if this is an issue from an upgrade to AGOL (from two weeks ago) or to the Py API as I recently switched to v1.5.1.

0 Kudos
Occasional Contributor

Update: as a work around to the bug that prevents me from using a View (from a Hosted Feature Layer) in geo-processing (spatial join), I've switched to using a feature collection.

Code to transform from feature layer to feature collection (with feature set in between) is:

items = gis.content.get('ItemID here')
lyrObs = items.layers[0]

fsetObsSensitiveLoc = lyrObs.query(where='IsSensitiveLoc=10')
fcollObsSensitiveLoc = FeatureCollection(fsetObsSensitiveLoc.to_dict())