spatial join arcgis pro

痴心易碎 提交于 2020-03-28 06:40:44

问题


I got this shape files Highway1,Highway2,Highway3 etc... The attribute tables are the same, they contain info about latitude, longitude , direction, shape_length and speed_allowed.

I want to make a script in python that would allow me to make a spatial join between every shape file that intersect other . For example if Highway1 intersect Highway2 , Highway12 and Highway22 i want 3 spatial join, every join should contain all the data from Highway 1 and where intersect the other highway, to have that info merged and where it does not intersect to have null values for the second highway.

Please help me write a script in order to automatically find if highway1 intersect other highway and if it does to make that kind of spatial join .

Thank you all !


回答1:


Please share replicable code examples and check https://stackoverflow.com/help/how-to-ask

However, you should find what you need in the ESRI Documentation and in the ArcPy Documentation. Try their code samples, adapt it to your needs and then you are able to ask more specifically.

Here's an example of ESRI's Intersect Docs:

#Name: VegRoadIntersect.py
# Purpose: Determine the type of vegetation within 100 meters of all stream crossings

# Import system modules
import arcpy

# Set the workspace (to avoid having to type in the full path to the data every time)
arcpy.env.workspace = "c:/data/data.gdb"    

# Process: Find all stream crossings (points)
inFeatures = ["roads", "streams"]
intersectOutput = "stream_crossings"
clusterTolerance = 1.5    
arcpy.Intersect_analysis(inFeatures, intersectOutput, "", clusterTolerance, "point")

# Process: Buffer all stream crossings by 100 meters
bufferOutput = "stream_crossings_100m"
bufferDist = "100 meters"
arcpy.Buffer_analysis(intersectOutput, bufferOutput, bufferDist)

# Process: Clip the vegetation feature class to stream_crossing_100m
clipInput = "vegetation"
clipOutput = "veg_within_100m_of_crossings"
arcpy.Clip_analysis(clipInput, bufferOutput, clipOutput)

# Process: Summarize how much (area) of each type of vegetation is found
# within 100 meter of the stream crossings
statsOutput = "veg_within_100m_of_crossings_stats"
statsFields = [["shape_area", "sum"]]
caseField = "veg_type"
arcpy.Statistics_analysis(clipOutput, statsOutput, statsFields, caseField)



来源:https://stackoverflow.com/questions/60590964/spatial-join-arcgis-pro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!