Populate point feature with value from underlaying polygon layer

600
3
04-14-2022 10:05 AM
EricBregant2
New Contributor II

I am creating a task where there are many steps to create and assign an address to a point feature. One of the steps I am trying to automate is to have information taken from some polygons that the point feature falls within. I know I can do a spatial join but the problem is, I don't want to end up with a bunch of extra tables from the join. Does anyone know another way to accomplish this? Maybe a script?

 

Thanks!

0 Kudos
3 Replies
jcarlson
MVP Esteemed Contributor

You can use a spatial intersection in a field calculation. I've done a very similar process to what you describe using Arcade:

var portal = Portal('your portal url')

var polygons = FeatureSetByPortalItem(
    portal,
    'itemid of polygon layer',
    0,
    ['the field you need'],
    true
)

// get first intersecting polygon
var xs = First(Intersects($feature, polygons))

// return value of desired field
return xs['the field you need']

If you're working with local layers as opposed to services, you can still pull in those other features with different FeatureSet functions in Arcade. 

- Josh Carlson
Kendall County GIS
0 Kudos
EricBregant2
New Contributor II

Thanks! I will check this out.

0 Kudos
EricBregant2
New Contributor II

So my data is not from Portal so I assume I would use FeatureSetbyName()

Below is what I am working with:

My Zip code layer is named  GISMAIN.DBO.qc_ZipCodes

The field I need to grab data from is "GEOID10"

EricBregant2_0-1649960323042.png

My dataset that needs the Zip Code appended in is called Addressses_TestData

EricBregant2_1-1649960587700.png

I basically need to make the user be able to click to add the address point, and have it populate the Zip field with the data from the layer under it. 

 

0 Kudos