Is there an out-of-the-box geoprocessing tool that will update a field in one layer based on the each features' spatial relationships with features in another layer without creating a temporary layer? I imagine this use case comes up very frequently:
-- what county (polygon) did this accident (point location) happen in?
-- what sector of the county (polygon) is this building permit (point location) in?
-- what school zone (polygon) is this address (point) in?
For years, I've been using the following tools in geoprocessing models
1) Spatial Join or Identity tool
2) Add an attribute index to the output of 1 to be used used in the next step (not always necessary if input layers have dont have numerous features)
3) Add (a tabular) Join between the input point layer and the output of number 1
4) Calculate field (transfer the attribute from the polygon to the point)
5) Remove join (if necessary for future steps in the geoprocessing model)
6) Delete the output of step 1 (this can be avoided by having geoprocessing models create temporary outputs)
7) Compact database (if the output of step 1 creates a lot of bloat in a geodatabase, assuming in-memory outputs were not used)
This not only wastes time when creating models, it also wastes time when running them since the temporary layer must be written to disk and then re-read (lots of pointless I/O). This is especially true when you have a huge number of points. I do realize that "in memory" layers are available, but that layer must first be created (even though it's not written to disk) and wastes time.
Yes, things will get a bit dicey when the point falls into two or more overlapping polygons. Not all polygon layers use "must not overlap" topology, but a good proportion do. The user could be given the option about how to handle two or more features, such as leaving the target field blank, writing the attributes for all of the overlapping features separated by a semicolon, only writing the first polygon that is found, or populating the field with error messages like "<two or more features overlap>" or -9999
I know that this can be done via spatial SQL in geodatabases that are built on SQL Server, Oracle or PostgreSQL. In those cases, it may only be possibly if the geometries are stored in the RDBMS's internal geometry types (as opposed to ESRIs geometry type). But that gets dicey if the input feature classes are versioned. And this approach is not possible with personal geodatabases, file geodatabases or shapefiles
I imagine that somebody has written their own tools or scripts to do this more efficiently. But searching for shared tools these days isn't very easy. Please post this tool if you have it! But I think that people shouldn't have to write tools for this because I imagine that this use case occurs frequently in many peoples' day-to-day tasks >> this should be an out-of-the-box geoprocessing tool