Select to view content in your preferred language

Return attributes from multiple fields on Intersects.

2614
5
11-24-2021 06:28 AM
AaronCRose
Emerging Contributor

Hello all,

I am trying to return multiple attributes into a single field using attributes rules and Intersects.

For example two polygons overlap, such as a separate county and a separate state feature class, if I have a road how can I pick up the state and county attribute "name" based on intersects and place them into a single field such as "County, State"?

0 Kudos
5 Replies
ABishop
MVP Regular Contributor

Hello Aaron,

Are you wanting to do this for a one time process or repeated workflow?  Also, what version of Pro are you in and what type of dataset?

Amanda Bishop, GISP
AaronCRose
Emerging Contributor

This will be a repeated workflow; currently running at 2.6.4 and the dataset consists of 12 feature classes that include points, lines, and polygons. 

AaronCRose_0-1638285691682.png

My goal is to have the name from multiple polygons returned in the name field for the intersecting feature, see above for an example. The closest solution I could find was from @jcarlson https://community.esri.com/t5/arcgis-pro-questions/help-with-intersect-intersection-attribute-rule/m...

Points, lines, and polygons will need to have this rule applied, but once I get one its easiest enough to figure out the others.

Thanks!

 

0 Kudos
JoeBorgione
MVP Emeritus

Below is a basic template you can follow: this is an attribute rule that fires upon insertion or modification of a site address point and returns the value of the ZIP field of an underlying polygon called "MSD.SLCOMSD.ZipcodesMSD" (a feature class in our Enterprise/SDE db) to the site address point feature.

The if/else block is key as it checks to be sure there is a valid intersection between the point feature and the respective underlying polygon.  Also, all of your features need to be in the same $datastore which is ESRI/Arcade for database.

var zip = FeatureSetByName($datastore,"MSD.SLCOMSD.ZipcodesMSD",["ZIP"], true)
var intersectLayer = Intersects(zip, Geometry($feature))
if (Count(intersectLayer) > 0) {
    var layer = First(intersectLayer);
    return layer.ZIP;    
} else {
    return null;
}

 

That should just about do it....
LeePenney
Emerging Contributor

Assuming you'd like the "County, State" field in the road layer, here is one way to accomplish that:

LeePenney_0-1637766815936.png

In this example I have the state of Maine and Aroostook County in two separate feature classes, and a section of road I'd like to update the attributes of as you described.

1. Run the "Intersect" tool with all layers

  • On the top ribbon click "Analysis > "Tools" and search "Intersect"
  • Unfortunately I don't think you can select specific attributes to combine, so "All Attributes" is your best option.
  • Choose "Line" as the output type 

LeePenney_1-1637766958055.png

2. Make a new field for the combined attributes

The updated road layer will have the state and county names in separate columns since they came from separate layers.

LeePenney_3-1637767483742.png

  • Right-click on the new road layer, click "Attribute Table", then click "Add" in the top-left ribbon in the table
  • Fill in the new field's properties. Make sure for 'Data Type" you select "Text"

3. Use the field calculator to combine the different attributes into your new field

  • Right-click your new field in the table view, and select "Calculate Field"
  • In the calculator, under the new field's name, enter the expression below to get the state and county fields separated by a comma: 

 

!Sate_Field! + ", " + !County_Field!​

LeePenney_4-1637767876946.png

 

 

  • Click 'OK' to run the calculator

LeePenney_5-1637767924755.png

Hope this helps!

AaronCRose
Emerging Contributor

AaronCRose_0-1638529841727.png

My goal is to have the name from multiple polygons returned in the name field for the intersecting feature, see above for an example. The closest solution I could find was from @jcarlson https://community.esri.com/t5/arcgis-pro-questions/help-with-intersect-intersection-attribute-rule/m...

Points, lines, and polygons will need to have this rule applied, but once I get one its easiest enough to figure out the others.