[R-sig-Geo] Question:manipulating spatial data using combination of Maptools and Splancs

kostas karis kostaskaris at hotmail.com
Mon Sep 19 17:38:20 CEST 2005


Dear Roger,
This is my fourth mail to u (we can call it a date :))
Ok, u are right that my mails were vague..It's the first time i ask help 
from a a mailing list so i'am a little unfamiliar with the process.i'll try 
to be more specific.Now i have 2 questions
I wrote the code as you suggested and after the conversion the kernel 
crashes again.I suspect it's the nx and ny options but i don't know how to 
adjust them.

>library(splancs)

Spatial Point Pattern Analysis Code in S-Plus

Version 2 - Spatial and Space-Time analysis
>library(maptools)
Loading required package: foreign
Loading required package: sp
>akto<-readShapePoly("Export_sterea_mac.shp",verbose=T)
Shapefile type: Polygon, (5), # of Shapes: 1
>quakes<-readShapePoints("QD15.shp")
>plot(akto)
>plot(quakes,add=T)
>sp_quakes<-coordinates(quakes)
>getSpPnParts(akto)
[1] 1
>sp_akto<-getPolygonCoordsSlot(getPolygonsPolygonsSlot(getSpPpolygonsSlot(akto)[[1]])[[1]])
>polymap(sp_akto)
>image(kernel2d(sp_quakes,sp_akto, h0=15,nx=100,ny=100),add=T)
Error in bbox(poly) : no direct or inherited method for function 'bbox' for 
this call (???)


In the above session i have used a single ring polygon.What if i wanted to 
import a polygon with many rings?My objective here is to import my countries 
boundaries (Greece). U realize that it's a polygon with many rings because 
it has many islands. When i ran the same code as above i take the following 
output:

>akto2<-readShapePoly("akto.shp",verbose=T)
Shapefile type: Polygon, (5), # of Shapes: 1
>getSpPnParts(akto)
[1] 2024

How can i convert all the rings?




More information about the R-sig-Geo mailing list