Spatial Join Bug with hosted feature layer

646
3
Jump to solution
11-03-2021 04:53 PM
Labels (3)
PhilipWeeks
New Contributor III

I've encountered an odd bug when performing spatial joins against a hosted feature layer of polygons.  I'm doing a spatial join of a local shapefile of points to a hosted feature layer of polygons inside of ArcPro to basically tag each point with the city it's in.  I've done this before and didn't notice any issues but this time all the highlighted points were treated as if they weren't inside a polygon even though all except 1 is.

PhilipWeeks_0-1635983214271.png

It seems like it's sharp rectangle cut off so it reminds me of how tiled areas are retrieved from web services.  This is random test data so it's not clear but I had points inside the same polygon both joined and not joined so it's not an object retrieval issue, it seems to be spatial based on the bounding rectangle.  I can export the web layer to a local file and it works fine but I'm still curious if anyone might have an explanation or fix for this issue when working directly with the web layer.  I've tried it both added to ArcPro via Add Data or via the .pitemx file from the Portal interface and have the same error.

Edit:

Another example with a different hosted layer with larger polygons which shows the test data both joining and not joining inside the same polygon.

PhilipWeeks_0-1635985230268.png

Edit2:

Other things I've tried, using way larger extents than default in the Environments section of the geo processing tool.  Also, since the join I was doing was part of an arcpy script I tried the standard Spatial Join from the right click-context menu in Arc Pro and received the same results.  It feels like Arc Pro is capable of grabbing stuff from an ArcGIS server hosted feature layer just fine for display but when it's retrieving geometry information for spatial joins it can only return info for a handful of tiles or a limited extent.

I've encountered this with several different polygon layers as well as layers on a staging server running on 10.9 instead of the 10.8 I was previously testing on.  I also tried a spatial join with a small selection of polygons and have the same issue where it treats everything beyond this rectangle as if it wasn't there.

0 Kudos
1 Solution

Accepted Solutions
PhilipWeeks
New Contributor III

I found a cause (though probably not the root cause) and a solution but I can't say that I like it.  For some reason the layers extents inside the service definition JSON did not cover the entire layer.  I had to eyeball what the boundaries were in ArcPro, go into the server admin console and edit the JSON key value pairs for "fullExtent" which had xmin/xmax values which probably lined up to where the geoprocessing tool wouldn't work.  Setting those much higher fixed the issue but I'm still curious what's causing it.  I'm guessing a default server extent?

View solution in original post

3 Replies
jcarlson
MVP Honored Contributor

If you're using the AGOL / Portal's built-in "Spatial Join", as opposed to the standard geoprocessing tool, I believe it defaults to using the map's current extent when it runs. Can you confirm if you ran all of your joins at the full extent, or if you were zoomed in when you did it?

For that matter, which version of the Spatial Join tool are you using?

- Josh Carlson
Kendall County GIS
0 Kudos
PhilipWeeks
New Contributor III

I've been using the latest release of Arc Pro.  The spatial join is done using an acrpy script with a call to arcpy.analysis.SpatialJoin.  The polygon layer is hosted on a server/portal running 10.8.  The points layer was just in a local file .GDB.  I've been encountering this on multiple polygon layers hosted and it seems to not occur if I export the hosted layer into a local .GDB.

0 Kudos
PhilipWeeks
New Contributor III

I found a cause (though probably not the root cause) and a solution but I can't say that I like it.  For some reason the layers extents inside the service definition JSON did not cover the entire layer.  I had to eyeball what the boundaries were in ArcPro, go into the server admin console and edit the JSON key value pairs for "fullExtent" which had xmin/xmax values which probably lined up to where the geoprocessing tool wouldn't work.  Setting those much higher fixed the issue but I'm still curious what's causing it.  I'm guessing a default server extent?