Shapefile Created with R
On Mon, Sep 20, 2010 at 1:17 AM, kapo coulibaly <kmcoulib at gmail.com> wrote:
I created contour a shape file using roughly the following code:
grd.contour<-contourLines(list.x,list.y,grd.mat,levels=nlevel)
grd.contour<-ContourLines2SLDF(grd.contour)
shapef<-tclvalue(tkgetSaveFile(filetypes="{{Shape Files} {.shp}} {{All
files} *}"))
writeLinesShape(grd.contour,shapef)
It works perfectly. The only problem is that all contours on the map with
the same value are attached to the same record. Basically if a select a
contour with elevation two, all contours on the map are selected even if
they are not spatially connected. Is there a way to create a contour shapes
with independant records even when values are equal.
Any help is greatly apprecciated.
The separate lines that you want are separate in the return from contourLines, and its the ContourLines2SLDF function that puts each line with the same height together. So you want to make a SLDF from the output from contourLines. This is one of those fiddly jobs that involves me remembering again how to build these things... See the help for SpatialLines, Lines, Line, and SpatialLinesDataFrame... Or I might have a solution in half an hour... Barry