Assign all attributes from a point layer to polygon layer

134
5
Jump to solution
08-09-2022 01:54 AM
VaL
by
New Contributor III

Hi all,

 

I have a point layer with 15 attributes. 

I digitized a polygon layer - one polygon around each point. 

How can I transfer/assign all attributes from the point layer to the polygon layer, based on point completely within polygon?

Thanks.

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Notable Contributor

So, just to be clear: the fields don't currently exist on the polygon layer? If that's the case, you may as well do a spatial join. Either do the GP tool and save the new output, or else do the right-click spatial join and save the result to a new layer.

In terms of automation, there are ways to copy portions of one layer's schema to another, but that really only needs to be done once. If your layers are in a geodatabase and you can take advantage of Attribute Rules, the same expressions posted earlier for calculating fields could be used to populate a polygon's attributes automatically if it were drawn around an existing point.

- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
5 Replies
EvelynHsu
New Contributor III

Try spatial join?

0 Kudos
jcarlson
MVP Notable Contributor

Assuming the fields had the same names, a Field Calculation could use a spatial operation using Arcade.

var pts = FeatureSetByName($map, 'your points layer name')

// get the intersecting point
var pt = First(Intersects($feature, pts))

return pt['field name']

You'd have to re-run it for every field, though.

How many point/polygon pairs are we talking about here? You could use the Transfer Attributes tool in the Modify Features pane, then it's just

  1. click point
  2. click polygon

For each pair. If the field names are different, you can open up the editing settings and define the field mapping between the two layers.

- Josh Carlson
Kendall County GIS
0 Kudos
JohannesLindner
MVP Regular Contributor

For each of the attributes, run the Calculate Field tool on your polygon fc. Switch to Arcade, copy and edit the code below.

// load your points
var point_fc = FeatureSetByName($datastore, "NameOfYourPointFC")
// get the point contained by the polygon
var contained_point = First(Contains($feature, point_fc))
// return null if there is no point
if(contained_point == null)  return null 
// else return the point's attribute
return contained_point.FieldName

Have a great day!
Johannes
0 Kudos
VaL
by
New Contributor III

Thanks all. My points is not to have to create the attribute fields on the polygon layer manually. Possibly it can be automated...

Spatial join - I was thinking about this. Do you mean the tool in the toolbox or the right-click>join potion on the layer?

0 Kudos
jcarlson
MVP Notable Contributor

So, just to be clear: the fields don't currently exist on the polygon layer? If that's the case, you may as well do a spatial join. Either do the GP tool and save the new output, or else do the right-click spatial join and save the result to a new layer.

In terms of automation, there are ways to copy portions of one layer's schema to another, but that really only needs to be done once. If your layers are in a geodatabase and you can take advantage of Attribute Rules, the same expressions posted earlier for calculating fields could be used to populate a polygon's attributes automatically if it were drawn around an existing point.

- Josh Carlson
Kendall County GIS
0 Kudos