[Openspace] Format for the ArcGIS 9.0-9.2 Weights Matrix File
Lauren Scott
lscott at esri.com
Wed May 14 17:25:24 CDT 2008
Hi,
Roger asked about the format for the user provided spatial weights
matrix file. It's specified in the ArcGIS "Modeling Spatial
Relationships" online help documentation. At 9.3 there will be 2 new
tools for generating spatial weights matrix files (they will offer new
options including Delaunay Triangulation, K Nearest Neighbors, Queen's
Case Contiguity... even relationships based on actual Road Network
travel time/distance... of course they will have the option to row
standardize, but will also offer the ability to force some minimum
number of neighbors). You will be able to convert/export these binary
weights files to a table where they can be edited, or else reformatted
for use with GeoDa. At 9.2, however (and unfortunately), the only
supported format is given below (excerpted from online documentation):
When the spatial weights matrix file is a simple ASCII text file, the
first line should be the name of a Unique ID field. This gives you the
flexibility to use any numeric field in your dataset as the id when
generating this file, however, the ID field must have unique values for
every feature. After the first line, the spatial weights file should be
formatted into three columns:
* From feature ID
* To feature ID
* Weight
For example, suppose you have three gas stations. The field you are
using as the ID field is called "StationID" and the feature IDs are 1,
2, 3. You want to model spatial relationships among these three gas
stations using travel time in minutes. You could create an ASCII file
that might look like the following:
StationID
1 1 0
1 2 1/10
1 3 1/7
2 1 1/10
2 3 1/20
3 1 1/6
3 2 1/15
3 3 0
Generally when weights represent distance or time, they are inverted
(e.g., 1/10 when the distance is 10 miles or 10 minutes) so that nearer
features have a higher weight than features that are farther away.
Notice from the weights above that gas station 1 is 10 minutes from gas
station 2. Notice also that travel time is not symmetrical in this
example (traveling from gas station 1 to gas station 3 is 7 minutes, but
traveling from gas station 3 to gas station 1 is only 6 minutes). Notice
that the weight between gas station 1 and itself is zero, and that there
is no entry for gas station 2 to itself. Missing entries are assumed to
have a weight of zero.
Typing the values for the spatial weights matrix file can be a tedious
job at best, even for small datasets. A better approach is to write a
quick python script to perform this task for you.
I hope this information is helpful.
Respectfully,
Lauren
Lauren M. Scott, Ph.D.
ESRI
Geoprocessing Spatial Statistics Product Engineer
380 New York Street
Redlands, CA 92373
More information about the Openspace
mailing list