Skip to content
Back to formatted view

Raw Message

Message-ID: <4ABCE84C.5000301@univ-lille1.fr>
Date: 2009-09-25T15:57:00Z
From: Maxime Pauwels
Subject: create polygons from a SpatialPixelDataFrame

Dear all,

Is there a simple way to create polygons from a SpatialPixelDataFrame?
Here is my script (data are in attached file):

projrpM<-read.table("NAproj.txt", header=T)
coordinates(projrpM)=~long+lat
gridded(projrpM)=TRUE
proj4string(projrpM)<-CRS("+proj=longlat")
#Get contour lines
projimgrpM<-as(projrpM, "SpatialGridDataFrame")
projimg1rpM<-as.image.SpatialGridDataFrame(projimgrpM["V1"])
projCLrpM<-contourLines(projimg1rpM, levels=0.000186)
projCLSLrpM<-ContourLines2SLDF(projCLrpM)
projlnsrpM<-list("sp.lines", projCLSLrpM, lwd=2, col="white",lty=1)
#Display results
spplot(projrp, scales=list(draw=T), xlim=c(-5, 30), ylim=c(40, 55),
cuts=12, pretty=T, col.regions=gray(180:40/200), sp.layout=list(projlnsrpM))

I'd like to fill the area delimited by white lines (attribute values
superior to levels=0.000186) in white. I could do using "cuts=", but my 
idea is to create an object I could add on another spplot, using 
sp.layout function

Could you help?

Many thanks

max



-- 
Maxime Pauwels
Researcher ID: http://www.researcherid.com/rid/A-1745-2009

Laboratoire de G?n?tique et Evolution des Populations V?g?tales
UMR CNRS 8016
Universit? de Lille, USTL-Lille1
http://gepv.univ-lille1.fr
Tel  : +33 3 20 43 40 76
Fax  : +33 3 20 43 69 79
			
?Impose ta chance, serre ton bonheur et va vers ton risque. A te 
regarder, ils s?habitueront.?
Ren? Char