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:
But the resultant attribute table doesn't include the GlobalID field:
Any ideas why this would be so?
Thanks
Hanlie
Solved! Go to Solution.
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.
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
)
I have experienced the same thing. Hoping that someone has encountered and fixed it!
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.
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 great idea thanks!
I noticed this could be accomplished in the GUI as well
Regards
Hanlie