Update address information from intersecting features in Address Data Management solution

862
1
07-17-2020 10:15 AM
ChrisFox
Esri Regular Contributor
2 1 862

The Address Data Management solution can be used by mapping technicians to maintain an inventory of road centerlines, valid road names, site addresses, and related mailing addresses.The solution includes an ArcGIS Pro project with a schema database and feature classes pre-configured with attribute rules to help automate and ensure the integrity of you addresses and centerlines while editing.

One capability that isn't included by default but can be configured in the solution is the ability to pull information from an intersecting feature when a new address is created or moved. For example, you might want to pull the name of the municipality, the zip code, or the property identification number (PIN) the address falls within and write it to a field within the site address point. This involves adding a new attribute rule to the Site Addresses feature class.

To add an attribute rule to your site addresses layer and pull information from an intersecting feature complete the steps below. It is important to note this rule requires both the addresses feature class and the feature class you want to pull the intersecting feature from be in the same database.

  1. In ArcGIS Pro from the Contents pane, right-click the Site Addresses layer.
  2. From the Design menu, select Attribute Rules.
  3. From the Attribute Rules view, click the drop-down next to Add Rule and select Add Immediate Calculation Rule.
  4. Provide a Name and Description for your rule.
  5. From the Field drop-down, select the field in your Site Addresses layer you want to write the attribute from the intersecting feature to.
  6. Click the Expression button to open the Expression Builder.
  7. Copy and paste the code below into the Expression Builder.
    // replace 'FeatureClassName' with the name of the feature class to pull intersecting features from (ex. Cities, ZipCodes, Parcels)
    var intersectingFeatures = Intersects(FeatureSetByName($datastore, "FeatureClassName"), $feature);
    for (var feature in intersectingFeatures) {
         // replace 'fieldname' with the name of the field from the intersecting feature to pull the value from
         var value = feature.fieldname;
    	 if (IsEmpty(value)) continue;
         return value;
    }
    return null;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
  8. In the code find and replace the text "FeatureClassName" with the name of the feature class to to pull intersecting features from (ex. Cities, ZipCodes, Parcels)
  9. In the code find and replace the text "fieldname" with the name of the field from the intersecting feature to pull the value from.
  10. Click the Verify button and click OK to close the Expression Builder.
  11. From Triggers, check Insert. If you would also like the rule to run when the address is moved as well, check Update.
  12. Click Save on the Attribute Rules tab on the ribbon. This button will be disabled if you have any pending feature edits, save or discard your edits to enable the Save button.

The rule should now be active, when you create a new site address point the rule should run and pull the attribute of the intersecting feature into the field specified by the rule. You could repeat the steps above to add additional rules for different feature classes and field values.

The code above is configured to return null if no intersecting features are found and if multiple intersecting features are found (overlapping polygons) it will return the first non null feature attribute found. Below are some additional code samples for some other common scenarios.

Return multiple intersecting feature values as comma delimited list

// replace 'FeatureClassName' with the name of the feature class to pull intersecting features from (ex. Cities, ZipCodes, Parcels)
var intersectingFeatures = Intersects(FeatureSetByName($datastore, "FeatureClassName"), $feature);
var values = [];
for (var feature in intersectingFeatures) {
	// replace 'fieldname' with the name of the field from the intersecting feature to pull the value from
	var value = feature.fieldname;
	if (IsEmpty(value)) continue;
	values [Count(values )] = value;
}
return Concatenate(values, ", ");
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Return multiple intersecting feature values as a statistic (Mean, Min, Max, Sum)

// replace 'FeatureClassName' with the name of the feature class to pull intersecting features from (ex. Cities, ZipCodes, Parcels)
var intersectingFeatures = Intersects(FeatureSetByName($datastore, "FeatureClassName"), $feature);
var values = [];
for (var feature in intersectingFeatures) {
	// replace 'fieldname' with the name of the field from the intersecting feature to pull the value from
	var value = feature.fieldname;
	if (IsEmpty(value)) continue;
	values[Count(values)] = value;
}
return Mean(values);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
1 Comment