Convertir la matrice de pondérations spatiales en table (Statistiques spatiales)

Niveau de licence :De baseStandardAvancé

Récapitulatif

Convertit un fichier de matrice de pondérations spatiales binaire (.swm) en table.

Illustration

Conversion de Swm en DBF
Les fichiers Swm peuvent être convertis en tables .dbf et mis à jour.

Utilisation

Syntaxe

ConvertSpatialWeightsMatrixtoTable_stats (Input_Spatial_Weights_Matrix_File, Output_Table)
ParamètreExplicationType de données
Input_Spatial_Weights_Matrix_File

Chemin d'accès complet du fichier de matrice de pondérations spatiales (.swm) que vous voulez convertir.

File
Output_Table

Chemin d'accès complet de la table que vous voulez créer.

Table

Exemple de code

Exemple d'utilisation de l'outil Convertir la matrice de pondérations spatiales en table (fenêtre Python)

Le script de fenêtre Python ci-dessous illustre l'utilisation de l'outil Convertir la matrice de pondérations spatiales en table.

import arcpy
arcpy.env.workspace = "c:/data"
arcpy.ConvertSpatialWeightsMatrixtoTable_stats("euclidean6Neighs.swm","euclidean6Neighs.dbf")
Exemple d'utilisation de l'outil Convertir la matrice de pondérations spatiales en table (script Python autonome)

Le script Python autonome ci-dessous illustre l'utilisation de l'outil Convertir la matrice de pondérations spatiales en table.

# Create a Spatial Weights Matrix based on Network Data 

# Import system modules
import arcpy

# Set the geoprocessor object property to overwrite existing output
arcpy.gp.overwriteOutput = True

# Local variables...
workspace = r"C:\Data\USCounties\US"

try:
    # 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") 

except:
    # If an error occurred when running the tool, print out the error message.
    print arcpy.GetMessages()

Environnements

Thèmes connexes

Informations de licence

ArcGIS for Desktop Basic : Oui
ArcGIS for Desktop Standard : Oui
ArcGIS for Desktop Advanced : Oui
9/13/2013