google-code-export / pysal

Automatically exported from code.google.com/p/pysal
Other
1 stars 1 forks source link

gwt writing and GeoDa #111

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
One other point that people keep emailing me about (mainly people who
want to e.g. incorporate inverse distance weights in GeoDa) is if
pySAL's gwt weights format can be seamlessly brought into GeoDa.
Usually we have problems with different gwt formats due to diverging
header files - if this is the only issue, we could include a quick
note in the weights documentation about the GeoDa header file format,
so people can change and import it. (It's: placeholder like 0 or 1
space N space filename space ID, e.g.: 1 211 baltim STATION).

(snip from jk email)

Original issue reported on code.google.com by sjsrey on 31 Jul 2010 at 2:24

GoogleCodeExporter commented 9 years ago
The following session will produce a knn (k=4) GWT file that is compatible with 
OpenGeoda.  PySAL however makes the weights as binary while OpenGeoDa assigns 
the distance between neighbors as the weight values.

>>> w = pysal.knnW_from_shapefile('baltim.shp', k=4, p=2, idVariable='STATION')
>>> gwt = pysal.open('baltim_PS_4nn.gwt','w')
>>> gwt.varName = 'STATION'
>>> gwt.shpName = 'baltim'
>>> gwt.write(w)
>>> gwt.close()

Original comment by schmi...@gmail.com on 31 Jul 2010 at 3:01