2

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",
    match_option="CLOSEST_GEODESIC",
    search_radius=0.001729,
    distance_field_name="distance")

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

enter image description here

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

1 Answer 1

0

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 and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.