Generate Spatial Weights Matrix (Räumliche Statistiken)
Zusammenfassung
Constructs a spatial weights matrix (.swm) file to represent the spatial relationships among features in a dataset.
Abbildung
Verwendung
-
Output from this tool is a spatial weights matrix file (.swm). Tools that require you to specify a Conceptualization of Spatial Relationships option will accept a spatial weights matrix file; select GET_SPATIAL_WEIGHTS_FROM_FILE for the Conceptualization of Spatial Relationships parameter and, for the Weights Matrix File parameter, specify the full pathname to the spatial weights file you create using this tool.
This tool also reports characteristics of the resultant spatial weights matrix file: number of features, connectivity, minimum, maximum and average number of neighbors. This summary is accessible from the Results window and may be viewed by right-clicking on the Messages entry in the Results window and selecting View. Using this summary, ensure that all features have at least 1 neighbor (8 neighbors is ideal). In general, especially with large datasets, a low value for feature connectivity is desirable.
-
Whenever using a distance-based Conceptualization of Spatial Relationships, data should be in a Projected Coordinate System (rather than a Geographic Coordinate System).
-
Für Linien- und Polygon-Features werden bei Entfernungsberechnungen Feature-Schwerpunkte verwendet. Für Multipoints, Polylinien oder Polygone mit mehreren Teilen wird der Schwerpunkt mithilfe des gewichteten arithmetischen Mittelpunkts aller Feature-Teile berechnet. Die Gewichtung für Punkt-Features ist 1, für Linien-Features "Länge" und für Polygon-Features "Fläche".
-
Das Feld Eindeutige ID ist mit Feature-Beziehungen verknüpft, die von der Ausführung dieses Werkzeugs abgeleitet werden. Infolgedessen müssen die Werte unter Eindeutige ID für jedes Feature eindeutig sein und in einem permanenten Feld vorgehalten werden, das bei der Feature-Class verbleibt. Falls Sie kein Feld "Eindeutige ID" verwenden, können Sie dieses auf einfache Weise erstellen. Fügen Sie der Feature-Class-Tabelle ein neues Ganzzahlfeld hinzu, und berechnen Sie die Feldwerte so, dass Sie dem Feld "FID/OID" entsprechen. Sie können das Feld "FID/OID" nicht direkt für den Parameter Eindeutige ID verwenden.
-
The polygon contiguity options, CONTIGUITY_EDGES_ONLY and CONTIGUITY_EDGES_CORNERS, for the Conceptualization of Spatial Relationships parameter are only valid for polygon features. These options are available with the ArcInfo license only.
-
The Number of Neighbors parameter may override the Threshold Distance parameter for Inverse or Fixed Distance Conceptualizations of Spatial Relationships. If you specify a threshold distance of 10 miles and 3 for the number of neighbors, all features will receive a minimum of 3 neighbors even if the threshold has to be increased to find them. The threshold distance is only increased in those cases where the minimum number of neighbors is not met.
The CONVERT_TABLE option for the Conceptualization of Spatial Relationships parameter may be used to convert an ASCII spatial weights matrix file to a .swm formatted spatial weights matrix file. First you will need to put your ASCII weights into a formatted table (using Excel, for example).
Vorsicht:If your table includes weights for self-potential, they will be omitted from the .swm output file, and the default self-potential value will be used in analyses. The default self-potential value for the Hot_Spot_Analysis tool is one, but this value can be overwritten by specifying a Self-Potential Field value; for all other tools, the default self-potential value is zero.
Für Polygon-Features sollten Sie in der Regel immer die Option Zeile für den Parameter Standardisierung auswählen. Die Zeilenstandardisierung verringert die Verzerrung, wenn die Anzahl der Nachbarn der einzelnen Features eine Funktion des Aggregationsschemas oder Sampling-Prozesses ist, und die tatsächliche räumliche Verteilung der analysierten Variable nicht widergespiegelt wird.
-
Das Hilfethema Modellierungen räumlicher Beziehungen enthält weitere Informationen zu den Parametern dieses Werkzeugs.
Denken Sie beim Verwenden von Shapefiles daran, dass diese keine Nullwerte speichern können. Werkzeuge oder andere Verfahren, die Shapefiles aus Nicht-Shapefile-Eingaben erstellen, speichern bzw. interpretieren Nullwerte ggf. als Wert 0. Dies kann zu unerwarteten Ergebnissen führen. Weitere Informationen finden Sie unter Überlegungen zur Geoverarbeitung für die Shapefile-Ausgabe.
Syntax
Parameter | Erläuterung | Datentyp |
Input_Feature_Class |
The feature class for which spatial relationships of features will be assessed. | Feature Class |
Unique_ID_Field |
An integer field containing a different value for every feature in the Input Feature Class. | Field |
Output_Spatial_Weights_Matrix_File |
The full pathname for the spatial weights matrix file (.swm) you want to create. | File |
Conceptualization_of_Spatial_Relationships |
Specifies how spatial relationships among features are conceptualized.
Note: Polygon Contiguity methods are only available with an ArcInfo license. | String |
Distance_Method |
Gibt an, wie Entfernungen von den einzelnen Features zu benachbarten Features berechnet werden.
| String |
Exponent (optional) |
Parameter for inverse distance calculation. Typical values are 1 or 2. | Double |
Threshold_Distance (optional) |
Specifies a cutoff distance for Inverse Distance and Fixed Distance conceptualizations of spatial relationships. Enter this value using the units specified in the environment output coordinate system. A value of zero indicates that no threshold distance is applied. When this parameter is left blank, a default threshold value is computed based on output feature class extent and the number of features. | Double |
Number_of_Neighbors (optional) |
An integer reflecting either the minimum or the exact number of neighbors. For K Nearest Neighbors, each feature will have exactly this specified number of neighbors. For Inverse Distance or Fixed Distance each feature will have at least this many neighbors (the threshold distance will be temporarily extended to ensure this many neighbors, if necessary). When there are island polygons and one of the Contiguity Conceptualizations of Spatial Relationships is selected, then this specified number of nearest polygons will be associated with those island polygons. | Integer |
Row_Standardization (optional) |
Row standardization is recommended whenever feature distribution is potentially biased due to sampling design or to an imposed aggregation scheme.
| Boolean |
Input_Table (optional) |
A table containing numeric weights relating every feature to every other feature in the input feature class. Required fields are the Input Feature Class Unique ID field, NID (neighbor ID), and WEIGHT. | File |
Codebeispiel
The following Python Window script demonstrates how to use the GenerateSpatialWeightsMatrix tool.
import arcpy arcpy.env.workspace = "C:/data" arcpy.GenerateSpatialWeightsMatrix_stats("911Count.shp", "MYID","euclidean6Neighs.swm","K_NEAREST_NEIGHBORS","#", "#", "#", 6,"NO_STANDARDIZATION")
The following stand-alone Python script demonstrates how to use the GenerateSpatialWeightsMatrix tool.
# Analyze the spatial distribution of 911 calls in a metropolitan area # using the Hot-Spot Analysis Tool (Local Gi*) # Import system modules import arcpy # Set geoprocessor object property to overwrite existing output, by default arcpy.gp.overwriteOutput = True # Local variables... workspace = "C:/Data" try: # Set the current workspace (to avoid having to specify the full path to the feature classes each time) arcpy.env.workspace = workspace # Copy the input feature class and integrate the points to snap # together at 500 feet # Process: Copy Features and Integrate cf = arcpy.CopyFeatures_management("911Calls.shp", "911Copied.shp", "#", 0, 0, 0) integrate = arcpy.Integrate_management("911Copied.shp #", "500 Feet") # Use Collect Events to count the number of calls at each location # Process: Collect Events ce = arcpy.CollectEvents_stats("911Copied.shp", "911Count.shp", "Count", "#") # Add a unique ID field to the count feature class # Process: Add Field and Calculate Field af = arcpy.AddField_management("911Count.shp", "MyID", "LONG", "#", "#", "#", "#", "NON_NULLABLE", "NON_REQUIRED", "#", "911Count.shp") cf = arcpy.CalculateField_management("911Count.shp", "MyID", "[FID]", "VB") # Create Spatial Weights Matrix for Calculations # Process: Generate Spatial Weights Matrix... swm = arcpy.GenerateSpatialWeightsMatrix_stats("911Count.shp", "MYID", "euclidean6Neighs.swm", "K_NEAREST_NEIGHBORS", "#", "#", "#", 6, "NO_STANDARDIZATION") # Hot Spot Analysis of 911 Calls # Process: Hot Spot Analysis (Getis-Ord Gi*) hs = arcpy.HotSpots_stats("911Count.shp", "ICOUNT", "911HotSpots.shp", "GET_SPATIAL_WEIGHTS_FROM_FILE", "EUCLIDEAN_DISTANCE", "NONE", "#", "#", "euclidean6Neighs.swm") except: # If an error occurred when running the tool, print out the error message. print arcpy.GetMessages()
Umgebungen
- Ausgabe-Koordinatensystem
Feature geometry is projected to the Output Coordinate System prior to analysis.