Hello I am looking for a way to speed up copying specific data from one layer to another, from 2 separate feature classes.
Normally this wouldn't be a problem. So here is the situation
Layer 1 Addresses - in my address layer I have a spot for PIN's and GISID from our Parcel Layer.
Layer 2 Parcels - contains the GISID and Parcel PINs
normally I would just copy and paste each one and that's fine and it works and its what I have been doing. but I am looking to speed up that process. my current project is about 300 edits that I have to manually copy/paste.
Does anyone know of a script/sql/python snippet I can run in calculate field to just pull those PIN/GISIDs and put them in my address layer. or if there already exists a tool.
Thanks in advance.
Solved! Go to Solution.
Using Field Calculate with Arcade lets you use spatial functions across layers, like Intersects. You can use this to access the attributes of an overlaying feature from the second layer and write those values into the fields on the first.
The exact format will depend on where your data "lives", but let's assume they're both in the same geodatabase. It might look like this for the GISID field:
var parcels = FeatureSetByName($datastore, 'parcels', ['GISID'])
// get intersecting parcel(s)
var xs = Intersects(parcels, $feature)
// if there are any parcels, get the attribute of the first
if (Count(xs) > 0) {
return First(xs)['GISID']
} else {
return null // or replace with "no value" text or whatever
}
Oh! For an enterprise geodatabase, you could just use spatial SQL, too. That will differ based on your RDBMS, but any spatial database should have something equivalent to PostGIS's ST_Intersects. You can use it in a table join, then update the addresses point using the results of the query.
Edit to add: If you're using geodatabase versioning, traditional or branch, the query is still possible, but gets a *lot* more complicated to ensure you're working with the right values.
Using Field Calculate with Arcade lets you use spatial functions across layers, like Intersects. You can use this to access the attributes of an overlaying feature from the second layer and write those values into the fields on the first.
The exact format will depend on where your data "lives", but let's assume they're both in the same geodatabase. It might look like this for the GISID field:
var parcels = FeatureSetByName($datastore, 'parcels', ['GISID'])
// get intersecting parcel(s)
var xs = Intersects(parcels, $feature)
// if there are any parcels, get the attribute of the first
if (Count(xs) > 0) {
return First(xs)['GISID']
} else {
return null // or replace with "no value" text or whatever
}
Yes they both live in the same datastore but in different geodatabases
Hope that helps visualize things
I will see if I can adapt your script to my needs and see what it does. Both fields in each feature class are the same PIN and GISID.
Thanks
Oh! For an enterprise geodatabase, you could just use spatial SQL, too. That will differ based on your RDBMS, but any spatial database should have something equivalent to PostGIS's ST_Intersects. You can use it in a table join, then update the addresses point using the results of the query.
Edit to add: If you're using geodatabase versioning, traditional or branch, the query is still possible, but gets a *lot* more complicated to ensure you're working with the right values.