[Openspace] Format for the ArcGIS 9.0-9.2 Weights Matrix File

Roger Bivand Roger.Bivand at nhh.no
Thu May 15 03:49:13 CDT 2008


On Wed, 14 May 2008, Lauren Scott wrote:

> 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.

Hi,

For example:

http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=Modeling%20spatial%20relationships

(sorry for the long CMS link, no permalink visible).

Thanks for your explanations. Could we however ask that the Arc weights be 
exchangeable - for export to GAL and GWT and readable from GAL and GWT, 
for example? The Matlab sparse format (three column more or less as below) 
would also be helpful, but even if ESRI uses something else, please 
document it and provide examples. GeoDa does very well on this, as you 
know.

The example on the Arc local Moran's I scripting page uses:

workspace = "C:/chris/data"
input = "assaults.shp"

whatever they might be. Without knowing that we are using the same data 
and weights, comments will come up - as we have seen - that GeoDa and Arc 
give very different local I values. In the case starting this thread, it 
appears that the weights differed. In trying things out with a colleague 
with 9.2 access, we could show that local Moran's I from GeoDa, R/spdep 
localmoran(), and Arc were the same for rook contiguity weights (though I 
think my colleague was under the impression that he chose queen).

As you say below, whipping up a Python script to import and export weights 
shouldn't be a problem, should it? Then when work on 9.3 is proceeding, 
you can check with weights from at least GeoDa, and if you like Matlab and 
R/spdep too (and let the community know when you find something 
questionable!).

Roger


> 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
>
> _______________________________________________
> Openspace mailing list
> Openspace at sal.uiuc.edu
> http://sal.uiuc.edu/mailman/listinfo/openspace
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the Openspace mailing list