Problems joining point and polygon layers

202
4
04-09-2020 09:31 PM
MikeCuenca
New Contributor II

In ArcMap online, I'm trying to join a point layer with data from all U.S. counties with a polygon layer of all those U.S. counties. When I use Join Features, the join quits after completing only a portion of the connections and leaves out most of them. I'm really at a loss for why they won't join completely. Does anyone have any input?

0 Kudos
4 Replies
SarahAmbrose
Esri Contributor

Hi Mike Cuenca‌,

Are you able to share your layers and parameters (a screen shot works) that you are using? If yes, can you please share the URLs and I can try and reproduce this? 

Has this tool worked as expected before? Or is this the first time you're running into this?

Thanks,

Sarah Ambrose

Product Engineer, Esri

0 Kudos
MikeCuenca
New Contributor II

Sarah--

Here are the two layers I'm trying to join.

https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases_US/FeatureServer 

https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Counties_analysis_trim/Feature... 

One is points and the other polygons. When I try to join them, the layers quit joining after adding only a few connections.

This is in ArcGIS online.

0 Kudos
SarahAmbrose
Esri Contributor

Hi Mike Cuenca‌,

Thanks for the datasets I've tried it out and I understand what's going on. 

Currently, the Join Features tool only joins when features have a match, and target features that don't have a match aren't included in the result. If you are familiar with ArcGIS Pro or ArcMap there is a setting to "Keep all Target Features" - this isn't currently an option in Join Feature in ArcGIS Online. 

So for an example with your data:

  • You have a point layer with 2737 features
  • A polygon layer with 3220 features
  • It looks like there is only ever one point per polygon, but some polygons do not have a point.

For example, here are the points (I made the points very big and purple) with the green polygons:

You can see that some polygons don't contain a point. When I run Join Features, I only see polygons returned where there are points. This image shows the original points and the Join Features result (blue polygons):

I have submitted and enhancement request to the team, and we'll work to add the option to keep target all features in a future release. 

In the meantime, I was able to complete the workflow you intended to do (or I assume you were working towards) by chaining a few tools together:

1. Run Join Features with target layer: polygons, join layer: points, and the spatial relationship completely contains. In this case I did a one to one join.

2. Overlay Layers - Erase. I ran Erase on the original polygon layers and the Join Result. This results in the original polygons that did not have points:

3. Merge Layers: Merge the Joined results (polygons where points existed) with the Erase results (polygons where points didn't exist). I removed the Area in Square <Units> field since I didn't need it and it should be recalculated when I run the tool. All other fields automatically matched:

And that should result in a layer with all polygons and their joined point values. Field values will be null for the polygons that don't have any intersecting points. Then when you do the symbology - make sure to check the value "Draw features with no value" so your map shows the joined polygons but notes there was no point data for those counties. 

The other way - but you might end up with some weird field names is to run Aggregate Points instead of Join Features. In that tool you can specify "Keep areas with no points". Since this tool will summarize point values, you'll need to calculate statistics for the single point value. So for example, the "sum of Deaths" will result in the single death value (so if the value was 5 for a point, the polygon will say sum_deaths = 5). So it will keep the value you are interested in, and just end up with an unexpected column name. 

Either workflow should work for this case though. Please let me know if you have any questions!

- Sarah

0 Kudos
MikeCuenca
New Contributor II

Thank you, Sarah!