SAGA GIS can convert lines to polygons (and run many other GIS operations on 
shapes):

> library(RSAGA)
> rsaga.get.usage("shapes_polygons",3)
SAGA CMD 2.0
Copyright (C) 2005 by Olaf Conrad
library path:   C:/Progra~1/saga_vc/modules
library name:   shapes_polygons
module name:    Convert Lines to Polygons
Usage: 3 -POLYGONS <str> -LINES <str>
  -POLYGONS:<str>       Polygons
        Shapes (output)
  -LINES:<str>          Lines
        Shapes (input)

But I do not really know how it works. As far as I know, to convert lines to 
polygons, the lines
need to be closed (no overlaps, no dead-ends) and a point map is needed to 
define the topology. See
for example - http://spatial-analyst.net/PDF/TN_Ortofoto_in_ILWIS.pdf 


Tom Hengl
http://spatial-analyst.net 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Jeebz
Sent: donderdag 17 juli 2008 21:18
To: r-sig-geo@stat.math.ethz.ch
Subject: Re: [R-sig-Geo] kernels, contours, points?

That's exactly the issue I think: anyone know how to turn a contour  
into a polygon??

On Jul 17, 2008, at 6:48 AM, Ashton Shortridge wrote:

> I think creative use of the overlay() function would accomplish what  
> you want.
> Some example code that is a bit like what you propose (uses the sp  
> library):
>
> # I have a polydataframe object:
> my.poly.data <- SpatialPolygonsDataFrame(my.poly, area.lu.table)
>
> # I have a set of point objects (derived, in this case, from  
> spsample):
> samgrid <- spsample(us.spPolys, 500, 'regular')
>
> # I'd like to know which poly in my.poly.data each point in samgrid  
> falls in:
> sample.area <- overlay(my.poly.data, samgrid)$name
>
> For this to work, you would need to figure out how to turn contours  
> into
> polys, which might be tricky, especially if they aren't closed and/ 
> or have
> holes (pits) within them.
>
> I admit that I am not very comfortable working with the sp objects,  
> and I
> would generally advise someone doing GIS-type work to use a GIS.  
> Hawth's
> (not "Hawk's") Analysis Tools are very useful in an ESRI  
> environment, as are
> built in commands and extensions in many GIS.
>
> yours,
>
> Ashton
> -- 
> Ashton Shortridge
> Associate Professor                   [EMAIL PROTECTED]
> Dept of Geography                     http://www.msu.edu/~ashton
> 235 Geography Building                ph (517) 432-3561
> Michigan State University             fx (517) 432-1671
>
> On Wednesday 16 July 2008, Jeebz wrote:
>> Hi
>>
>> I'm new to the R spatial packages, but I have a spatial-oriented task
>> I would like to accomplish.
>>
>> I have a 2d grid of points and each point has a class (13 classes
>> total in the dataset).  The grid is small-ish, only 256x256.  I have
>> run a 2d kernel density estimation (using kde2d) and can create a
>> contour plot easily (per class).
>>
>> What I would like to do is use a contour line to extract all the
>> points from the original grid that are bounded by that contour.
>> Ultimately, I wish to calculate a sort of "purity" measure, so  
>> given a
>> particular contour (e.g. a contour level that encloses 95% of the
>> classes points), how many points from other classes fall in with the
>> classes that were used to define the contour.
>>
>> I know there has to be a way to do this with R... right?  A colleague
>> of mine showed my how it could be done using ArcGIS and "Hawkes
>> tools", by calculating percent volume contours, but I don't know  
>> where
>> to begin in R.
>>
>> Anyone have any thoughts or examples on this?
>>
>> Much thanks in advance,
>>
>> bct
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo@stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to