Select to view content in your preferred language

Spatial join of unique ID from one polygon layer to another

233
2
05-28-2024 12:22 PM
Labels (3)
CamrynHill
New Contributor II

Hello everyone!

This may be a silly question but how would you go about this process?

I'm still relatively new to GIS and am currently tasked to "Create a unique ID for lagoon features (polygon) as well as to update the barn feature class (polygons) to list each associated lagoon's unique ID." 

I've created the unique ID for the lagoons by creating a new field and calculating the field with the sequential number function, so that part is finished.

However, I'm stumped on the second half. I would think to relate the unique ID and go about that process but my boss is asking for me to spatially join them. I'm not well versed in spatial joining so any advice would be helpful.

Other information:

Lagoons  (blue) = 2,544 polygons total

Barns (black) = 8,490 polygons total

There are in most cases more than one lagoon per farm (x number of barns).

None of them intersect, so it would have to be by a geodesic distance.

CamrynHill_0-1716924052295.png 

CamrynHill_1-1716924123057.png

 

 

0 Kudos
2 Replies
marksm_macomb
Occasional Contributor

I have some questions, and then I have something for you to try based on the answers to those questions and it does not involve a spatial join. 

Is the main goal to get a list of lagoon ID's written to a field in the associated barn features? If there are multiple lagoons for a particular barn, does he want all the ID's listed in a single field? Split out into multiple fields?

If it's okay that all ID's are listed in a single field, here is a way you can go about it without doing a spatial join, but rather doing a field calculation on the "Lagoon ID" field within the Barn polygon, using geometry functions in Arcade (which is sort of like a manual spatial join anyways but just for a one time calculation).

I have not actually tried this, but it could be a good place to start experimenting. You will also need to determine the right buffer distance to grab the appropriate lagoons (is the furthest barn-lagoon pair distance shorter than the closest distance between farms?)

 

// create the distance buffer around the barns
var buff = Buffer($feature, 0.5, 'miles')

// get intersecting lagoons
var xs_lagoons = Intersects(buff, FeatureSetByName($datastore, 'lagoon_layer_name'))

// loop through the returned lagoons and populate an array
var lagoon_list = []

for (var L in xs_lagoons) {
    // push a formatted string to the lagoon_list array
    Push(lagoon_list, L.lagoon_id_fieldname)
}

// return a comma-delimited string from your array
return Concatenate(lagoon_list, ', ')

 

 

I referenced these other community posts to get here. They are being asked in the context of ArcGIS Online but the scripts can be reworked for a field calculation in Pro:

Solved: arcade script for popup - Esri Community

Solved: Trying to create a list of intersecting features u... - Esri Community

0 Kudos
Eugene_Adkins
Occasional Contributor III

Here's some documentation on using spatial join: Spatial Join (Analysis)—ArcGIS Pro | Documentation

You may want to use "Closest" or "Within a distance" as the match option.

0 Kudos