How can I reproduce the same result of this tool using ArcPy?

enter image description here

Here are the tables I want to join:

enter image description here

enter image description here

Here's the result im getting from ArcMap tool:

enter image description here

I wrote Python code to reproduce the same result:

arcpy.SpatialJoin_analysis(gpsFC, hotspotFC, "test2.shp", join_operation="JOIN_ONE_TO_ONE",
    join_type = "KEEP_COMMON",

but I'm not getting the same result, instead I'm getting this one:

enter image description here

  • 1
    Are both of your layers in lat/long? Do you have a selection on one of the layers?
    – Hornbydd
    Apr 4 '20 at 20:35
  • Nope, one has a shape (point) and the other has lat/lon, as you can see in screenshots. Apr 5 '20 at 10:25

I solved the problem by switching gpsFC and hotspotFC, and setting distance = 0.03 and match_option="CLOSEST".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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