<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=FR link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span lang=EN-US>Dear all ,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>I have a problem in converting some interpolated
contourLines into SLDF, using the function ContourLines2SLDF. I tried with the
example given in “Applied Spatial Data Analysis wit R”, but for
similar input data, the function returns a strange SLDF with my data… I
am then unable to check for equality between first and last coordinates (suitable
to create polygons)..<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Does someone know what’s wrong with
my code??<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Many thanks for your help!<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>library(maptools)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>load(“XXX/interpolated_den.Rdata”)
## the data is called DDD…<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>AA<-contourLines(DDD,levels=c(2))
## I keep only the isolines of level 2<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>test<-ContourLines2SLDF(AA)
## library(maptools) transforme les isolignes en
SpatialLinesDataFrame<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>lns<-slot(test,"lines")
# as in the ASDAR p. 48<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>table(sapply(lns,function(x)
length(slot(x,"Lines"))))<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><i><span lang=EN-US style='color:#365F91'>## return 28/1
rather that 1/28 -> lns is a list 1 object composed of 28 lines, rather than
being a list of 28 object of 1 lines….<o:p></o:p></span></i></p>
<p class=MsoNormal><i><span lang=EN-US style='color:#365F91'>## thus I can’t
do the next step…<o:p></o:p></span></i></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>table(sapply(lignes, function(x) { <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>coord<-slot(slot(x,"Lines")[[1]],"coords")
<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>identical(coord[1,],coord[nrow(coord),])}))<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:12.0pt;color:#336600'>___________________________________________________________<o:p></o:p></span></b></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:12.0pt;color:#336600'><o:p> </o:p></span></b></p>
<p class=MsoNormal><b><span lang=EN-US style='color:#336600'>Ervan Rutishauser<o:p></o:p></span></b></p>
<p class=MsoNormal><span lang=EN-US style='color:#336600'>PhD student<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='color:#336600'>CIRAD - UMR AMAP <br>
BP 701<br>
97387 Kourou Cedex </span><span lang=EN-US style='color:#1F497D'><o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#336600'>tel. 00594.594.32.92.96<o:p></o:p></span></p>
<p class=MsoNormal><span lang=FR-CH><o:p> </o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>