5

ArcGIS Pro 3.2

When using geoprocessing tools, the field map has options such as:

  • First - The first field value
  • Last - The last field value

https://pro.arcgis.com/en/pro-app/3.2/help/analysis/geoprocessing/basics/field-map.htm

How does Pro determine what is "first" or "last"? Is it based on object ID?

For example, a spatial one-to-one join with point and polygon where a point lands on the boundary of two polygons. The spatial join will assign attributes from one of the polygons that it determined was "first" or "last".

Added context if it's important: Sometimes I use a PostgreSQL database, sometimes I use a file geodatabase.

Added clarification: I'm not providing a First or Last option for someone to choose. I leave the default as First during my process. I'm just curious conceptually about these two options since they have similar descriptions and I've been asked how I got my results.

6
  • 1
    I suspect that it will depend on the underlying database (eg, MS SQL, file geodatabase, Oracle, PostgreSQL). In RDBMS general theory, you are expected to NEVER rely on which order the records may be returned in, because it is not guaranteed to be the same each time (even for the same query against the same data). In practice, it is usually in order the data records were created (so yes, OBJECTID in this case), but you should not rely on it. One significance of "First" in this case is that it will not need to check more than one value during processing. In theory that would be quicker. Commented May 29 at 0:33
  • @SonofaBeach gotcha, added DB context into question. It just feels like "Idk the software / database decides it randomly" isn't the best answer when a manager asks how I got certain results.
    – sushi
    Commented May 29 at 16:34
  • I agree. I voted your question up because I'd also be very curious to know a more definitive answer. It doesn't affect my work (so far), so it's just curiosity for me. I've used Sum, Max, Min and First, but never felt the need to use Last for anything. And when I use First, it's only ever been for cases where it doesn't really matter which of the values is used, because I know they are (or should be) all the same value. Commented May 29 at 22:26
  • 1
    If it's random why providing the two option first and last ? it's probably a question to be directed to ESRI support to get an authoritative answer...
    – J.R
    Commented May 30 at 8:51
  • @J.R added clarification to question. I'm not presenting first / last as options or parameters to anyone. Their descriptions are similar so I was curious conceptually about them.
    – sushi
    Commented May 30 at 16:44

1 Answer 1

2
+50

I did simple experiment,- spatial join of points to lines shown. enter image description here

First I physically sorted lines in descending order by length and kept only length attribute in joined points. This attribute shown in the picture below:

enter image description here

Second time I sorted lines in ascending order and re-run spatial join:

enter image description here

It seems what they call "first" is record position AND it is default option, because it works much faster, no need to analyze remaining candidates.

Note: I did it using in_memory workspace. I don't see a reason of this behavior being different in file geodatabase.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.