Select to view content in your preferred language

Apply attribute within Zone

373
2
08-22-2024 01:42 PM
Labels (1)
mp8
by
New Contributor

Hello all,

I need some assistance. I feel like these are easy tasks but I can't remember how to execute them and my questions online are not bringing up what I need.

1.) I created 4 Zones on the map to divide the town. I want to select streets within a Zone and then apply an attribute. For example all streets in Zone A will be applied "A" for the "Belong" field.

2.) Then I want to create a Pop Up for the Zones layer to bring in the "Full Street Names" based on the "Belong" field that have the "A" designation.

See pictures below for reference. Thank you for your help.

*The pop-up currently is just text I inputted but I'd rather the program input names this time around.1.png2.png

2 Replies
Eugene_Adkins
Frequent Contributor

The most simplistic way to complete the task would be to use the "select by location" option where your "input" would be the roads, the "relationship" would probably be "intersect" or "have their center in" and the "selecting features" would be the zone.

The problem you may come across is your roads may not end exactly where the line for your zone polygon is located. You could use the "pariwise clip" tool to clip out your roads using your zones, and then the "select by location" tool would only select the portion of a road that is contained within the zone itself. If you do not do something like this, it's likely you will have a road that crosses multiple zones which will mess with the complete accuracy of your zone field in the road attribute table.

There are other tools (such as union) that can combine the data of the two feature classes but if you're looking to keep your roads and zones features clean, I think the above workflow should do the job.

JesseWickizer
Esri Contributor

The popup profile can use Arcade's FeatureSet functions with $map to get info about features intersecting a clicked feature or matching a query that references the clicked feature. 

In these examples I have a Streets layer and a Regions polygon layer in my map. The Streets layer has Name and Included attributes. I include these expressions in the Regions popup expressions so I can reference them in the popup. 

Example 1: Return the names of all streets intersecting the clicked region polygon feature.

var streets = FeatureSetByName($map, "Streets", ["Name"], true);
//Get all street intersecting the clicked feature, and sort them by Name
var streetsSorted = OrderBy(Intersects(streets, $feature), "Name ASC");

var streetNames = [];
for (var street in streetsSorted) {
  //Only add if it's not already in the array
  if (!Includes(streetNames, street.Name)) {
    //Add to the array
    Push(streetNames, street.Name);
  }
}
return Concatenate(streetNames, ", ");

 

Example 2: Return the names of streets intersecting the clicked region polygon feature and matching an attribute query

var streets = FeatureSetByName($map, "Streets", ["Name", "Included"], true);
//Filter the streets to only those matching an attribute query
var filterQuery = "Included = 'yes'";
var matchingStreets = Filter(streets, filterQuery);

//Get the matching streets that intersect the clicked feature, and sort them by Name
var matchingStreetsSorted = OrderBy(Intersects(matchingStreets, $feature), "Name ASC");

var streetNames = [];
for (var street in matchingStreetsSorted) {
  //Only add if it's not already in the array
  if (!Includes(streetNames, street.Name)) {
    //Add to the array
    Push(streetNames, street.Name);
  }
}
return Concatenate(streetNames, ", ");

 

JesseWickizer_0-1732571303018.png

 

Modify these expressions to match your data schema and desired sql query.

0 Kudos