Hello,
I have a polygon layer with a number of null values, and i would like to populate the values with the values from ajdacent polygons. The tools that I found merely create a table, but I would like to incorporate a process into a model.
Is there a tool or python script that would be able perform this?
I attached a small screenshot to see what i want to do, the shape with no values are circled.
Regards,
Justin
@JustinBernard1886 - I believe you can do this by using the 'Calculate Field' and an Arcade Expression.
I have mocked up a test
The Arcade Expression updates all the null values with an attribute from the touching polygon.
Update your Layer Name (TEST in my example) and Field Name (my field name was FIELD_A)
Var calculated_result = ""
Var touching_polygons = Intersects (FeatureSetByName($datastore, "TEST"),$feature)
Var Cnt = Count(touching_polygons)
If ( IsEmpty($feature.FIELD_A) && Cnt > 1)
{
For ( var every_polygon in touching_polygons)
{
calculated_result = every_polygon.FIELD_A
return calculated_result
}
}
return $feature.FIELD_A
Output
Hope this helps.
@gis_KIWI4 offers a solution that will guarantee that empty polygons are given a value, but which one? In their screen shot there are clearly two polygons adjacent to polygons with differing values. So as the code runs now it simply overwrites with the last visited polygon.
If that is sufficient then OK but you might want to explore the Polygon Neighbours tool to help quantify the importance of adjacency by shared boundary length?