[R-sig-Geo] Reading ArcGIS 9.3 spatial weight matrix [swm] file

Roger Bivand Roger.Bivand at nhh.no
Thu Mar 18 15:23:21 CET 2010


On Thu, 18 Mar 2010, Gindo Tampubolon wrote:

> Dear all,
>
> Can anyone tell me how to read ArcGIS 9.3 generated .swm file [spatial 
> weight matrix] into R?

Well, make a number of small samples available on a website - most people 
do not have access to Arc, so helping is hard. Is there an ESRI site with 
shapefiles and matching sample *.swm files?

>
> I am stumped at page 242 of the ASDAR book [Bivand et al 2008]. I use a 
> SpatialPolygonsDataFrame object and tried to generate neighbours list 
> using poly2nb(). It took more than 24 hours [European data NUTS level 3 
> about 1500 regions]. After finishing, the result is a null set.
>

Always try a subset first. Most likely you need the snap= argument, if the 
boundaries do not touch but are close to each other. Almost certainly your 
input map also had far too much detail in shorelines and river borders, 
leading to your machine getting overloaded (Windows?). Displaying on such 
a map would also be dominated by line detail.

> So I generate a rook weight matrix in ArcGIS 9.3 [and convert it to a 
> table there]. How do I import this matrix to R?

Contribute by making sample files available. To read a matrix if you must, 
use read.table().

Roger

>
>
> I looked at RArcInfo and rgdal packages but could not find anything 
> obvious; I'm experimenting with read.gwt2nb() but ArcGIS created swm 
> based on numeric ID instead of NUTS_CODE alphanumeric; needs tweaking 
> perhaps.
>
> Many thanks
>
> Gindo
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
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 R-sig-Geo mailing list