空间连接arcgis pro

2024-04-29 16:26:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我在1号公路,2号公路,3号公路等处找到了这个形状的文件。。。属性表是相同的,它们包含关于纬度、经度、方向、形状长度和允许的速度的信息

我想用python编写一个脚本,允许我在每个相互相交的形状文件之间进行空间连接。例如,如果Highway1与Highway2、Highway12和Highway22相交,我想要3个空间连接,则每个连接都应包含来自Highway 1的所有数据以及与另一条公路相交的位置,以合并该信息,并在不相交的位置为第二条公路设置空值

请帮我写一个脚本,以便自动找到1号公路是否与其他公路相交,以及它是否与其他公路相交,从而实现这种空间连接

谢谢大家!


Tags: 文件脚本信息属性空间方向速度形状
1条回答
网友
1楼 · 发布于 2024-04-29 16:26:22

请共享可复制的代码示例并选中https://stackoverflow.com/help/how-to-ask

但是,您应该在ESRI DocumentationArcPy Documentation中找到您需要的内容。尝试他们的代码示例,根据您的需要进行调整,然后您就能够提出更具体的要求

下面是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)

相关问题 更多 >