空間加重マトリックス → テーブル (Convert Spatial Weights Matrix to Table) (空間統計)

サマリー

バイナリの空間加重マトリックス ファイル (.swm) をテーブルに変換します。

空間加重マトリックス → テーブル ツールの図
swm ファイルを .dbf テーブルに変換して編集することができます。

使用法

パラメーター

ラベル説明データ タイプ
入力空間加重マトリックス ファイル

変換する空間加重マトリックス ファイル (.swm) の完全パス名。

File
出力テーブル

作成するテーブルの完全パス名。

Table

arcpy.stats.ConvertSpatialWeightsMatrixtoTable(Input_Spatial_Weights_Matrix_File, Output_Table)
名前説明データ タイプ
Input_Spatial_Weights_Matrix_File

変換する空間加重マトリックス ファイル (.swm) の完全パス名。

File
Output_Table

作成するテーブルの完全パス名。

Table

コードのサンプル

ConvertSpatialWeightsMatrixtoTable の例 1 (Python ウィンドウ)

次の Python ウィンドウ スクリプトは、ConvertSpatialWeightsMatrixtoTable 関数の使用方法を示しています。

import arcpy
arcpy.env.workspace = "c:/data"
arcpy.stats.ConvertSpatialWeightsMatrixtoTable(
    "euclidean6Neighs.swm", "euclidean6Neighs.dbf")
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.stats.GenerateSpatialWeightsMatrix(
    "USCounties.shp", "MYID", "euclidean6Neighs.swm", "K_NEAREST_NEIGHBORS",
    "#", "#", "#", 6) 

# Dump Spatial Weights to Database Table.
# Process: Convert Spatial Weights Matrix to Table...       
dbf = arcpy.stats.ConvertSpatialWeightsMatrixtoTable(
    "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.stats.GenerateSpatialWeightsMatrix(
    "USCounties.shp", "MYID", "euclidean6Neighs.swm", "CONVERT_TABLE", "#",
    "#", "#", "#", "#", "#", "euclidean6Neighs.dbf")

関連トピック