[R-sig-Geo] writing shapefiles using write.pointShape

modern82376 at mypacks.net modern82376 at mypacks.net
Sun Mar 16 04:42:36 CET 2008


Thank you Jakob. I figured that if I couldn't get the write.pointShape function to work the way I wanted, I'd have to do something like that. I'll keep your code as a backup, since I'd like to automate some processes.
 
Cheers. 
 
Gericke Cook
USDA APHIS

---------------------------------------------------

More a work-around than a solution, but you could export the results
data.frame as a csv and then import as an xy in arcmap (then save as a shp).
The Columbus example...

## GWR example

library(spgwr)

data(columbus)

main <- columbus

main <- cbind(main, region=1:49)

main.lm <- lm(crime ~ income + housing, data=main)

summary(main.lm)

main.bw <- gwr.sel(crime ~ income + housing, data=main,

  coords=cbind(main$x, main$y))

main.gauss <- gwr(crime ~ income + housing, data=main,

  coords=cbind(main$x, main$y), bandwidth=main.bw, hatmatrix=TRUE)

main.gauss

main.gauss$SDF

main_res <- cbind(main, main.gauss$SDF)

main_res

write.table(main_res, file = "main_gwr.csv", sep = ",", col.names = NA)




Jakob Petersen

PhD candidate
Geography UCL




More information about the R-sig-Geo mailing list