Select to view content in your preferred language

Spatial join doesn't transfer GlobalID field

278
3
Jump to solution
06-04-2024 12:11 AM
HanliePetoors
Occasional Contributor

Hi,

I'm working in ArcGIS Pro 3.3.0 with an MS SQL Server SDE.

I specified a spatial join as follows because I want to copy the Building.GlobalID field to the RentalUnit.BuildingGlobalID field:

HanliePetoors_0-1717484811632.png

But the resultant attribute table doesn't include the GlobalID field:

HanliePetoors_2-1717485013479.png

Any ideas why this would be so? 

Thanks

Hanlie

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MicZatorsky_AEC
Occasional Contributor III

A SpatialJoin in 3.2.2 does not show a joined table's GlobalID in the joined feature class, despite including it in the GUI's field mapping.

MicZatorsky_AEC_0-1717715779866.png

But, if you copy the Python command and edit the field mapping, you can get the Global ID in a Text field. Here, I just changed the output field name to pt_GlobalID and the type to Text:

arcpy.analysis.SpatialJoin(
target_features="foo_pg",
join_features="foo_pt",
out_feature_class=r"C:\Scratch\Scratch.gdb\foo_pg_SpatialJoin",
join_operation="JOIN_ONE_TO_ONE",
join_type="KEEP_ALL",
field_mapping='Shape_Length "Shape_Length" false true true 8 Double 0 0,First,#,foo_pg,Shape_Length,-1,-1;Shape_Area "Shape_Area" false true true 8 Double 0 0,First,#,foo_pg,Shape_Area,-1,-1;GlobalID "pt_GlobalID" false false true 38 Text 0 0,First,#,foo_pt,GlobalID,-1,-1;foodoo "foodoo" true true false 100000 Text 0 0,First,#,foo_pt,foodoo,0,99999',
match_option="INTERSECT",
search_radius=None,
distance_field_name="",
match_fields=None
)

MicZatorsky_AEC_3-1717716116233.png

 

View solution in original post

0 Kudos
3 Replies
ZachBodenner
MVP Regular Contributor

I have experienced the same thing. Hoping that someone has encountered and fixed it!

0 Kudos
MicZatorsky_AEC
Occasional Contributor III

A SpatialJoin in 3.2.2 does not show a joined table's GlobalID in the joined feature class, despite including it in the GUI's field mapping.

MicZatorsky_AEC_0-1717715779866.png

But, if you copy the Python command and edit the field mapping, you can get the Global ID in a Text field. Here, I just changed the output field name to pt_GlobalID and the type to Text:

arcpy.analysis.SpatialJoin(
target_features="foo_pg",
join_features="foo_pt",
out_feature_class=r"C:\Scratch\Scratch.gdb\foo_pg_SpatialJoin",
join_operation="JOIN_ONE_TO_ONE",
join_type="KEEP_ALL",
field_mapping='Shape_Length "Shape_Length" false true true 8 Double 0 0,First,#,foo_pg,Shape_Length,-1,-1;Shape_Area "Shape_Area" false true true 8 Double 0 0,First,#,foo_pg,Shape_Area,-1,-1;GlobalID "pt_GlobalID" false false true 38 Text 0 0,First,#,foo_pt,GlobalID,-1,-1;foodoo "foodoo" true true false 100000 Text 0 0,First,#,foo_pt,foodoo,0,99999',
match_option="INTERSECT",
search_radius=None,
distance_field_name="",
match_fields=None
)

MicZatorsky_AEC_3-1717716116233.png

 

0 Kudos
HanliePetoors
Occasional Contributor

@MicZatorsky_AEC  great idea thanks!

I noticed this could be accomplished in the GUI as well

HanliePetoors_0-1717744251039.png

Regards

Hanlie