Skip to content
Prev 10960 / 29559 Next

convert a PBSmapping grid to shapefile

Thanks for your answer Roger but it still doesn't work...
The problem is with mo, has you said it needs more study and I don't how 
to solve the problem.

Here is the problem :

library(PBSmapping)

PS0=makeGrid(x=seq(-5,-1,.2),y=seq(43,49,.2),projection="LL")
PD=read.table("pdata.txt",header=T) # text file attach

brks=c(fivenum(PD$Z))
cols=c("white","yellow","orange","red","darkred")
PD0=makeProps(PD,breaks=brks,"col",cols)

plotPolys(PS0, polyProps=as.PolyData(PD0), projection="LL",bg="lightblue")
sp1 <- PolySet2SpatialPolygons(PS0)
mo <- match(as.character(PD0$PID), row.names(sp1))
sp2 <- SpatialPolygonsDataFrame(sp1, data=data.frame(col=PD0$col[mo],
   stringsAsFactors=FALSE))
plot(sp2, col=sp2$col, axes=TRUE)


Many thanks in advance if you find a solution.
And if it is not possible I will do the same using only the sp package...

Regards.
Armelle Rouyer



Roger Bivand a ?crit :