二进制空间权重矩阵_将空间权重矩阵转换为表 (空间统计)

本文提供了一个独立的Python脚本示例,演示如何使用ConvertSpatialWeightsMatrixtoTable函数将基于网络数据的二进制空间权重矩阵转换为数据库表。脚本涉及设置工作空间、创建空间权重矩阵并将其保存到DBF文件,以便于编辑和进一步处理。
摘要由CSDN通过智能技术生成

ConvertSpatialWeightsMatrixtoTable 示例 2(独立脚本)

以下独立 Python 脚本演示了如何使用 ConvertSpatialWeightsMatrixtoTable 功能。

# Create a Spatial Weights Matrix based on Network Data

# Import system modules

import arcpy

# Set property to overwrite existing output

arcpy.env.overwriteOutput = True

# Local variables...

workspace = r"C:\Data\USCounties\US"

# Set the current workspace (to avoid having to specify the full path to the

# feature classes each time)

arcpy.env.workspace = workspace

# Create Spatial Weights Matrix

# Process: Generate Spatial Weights Matrix...

swm = arcpy.GenerateSpatialWeightsMatrix_stats("USCounties.shp", "MYID",

"euclidean6Neighs.swm",

"K_NEAREST_NEIGHBORS",

"#", "#", "#", 6)

# Dump Spatial Weights to Database Table

# Process: Convert Spatial Weights Matrix to Table...

dbf = arcpy.ConvertSpatialWeightsMatrixtoTable_stats("euclidean6Neighs.swm",

"euclidean6Neighs.dbf")

# Now you can edit the spatial weights (add, subtract and alter

# neighbors and weights)

# Read weights from table back into Spatial Weights Matrix format

# Process: Generate Spatial Weights Matrix...

swm = arcpy.GenerateSpatialWeightsMatrix_stats("USCounties.shp", "MYID",

"euclidean6Neighs.swm",

"CONVERT_TABLE",

"#", "#", "#", "#", "#", "#",

"euclidean6Neighs.dbf")

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值