[R-sig-Geo] Divide a polygon by a line?

Agustin Lobo Agustin.Lobo at ija.csic.es
Wed Oct 31 08:10:36 CET 2007

I've finally done this operation with a GIS. I was trying to
perform all this part of the project within R, trying not to use
any other tool, as a test. It's clear that the boundary
between GIS and spatial analysis is more and more fuzzy.
In my opinion, just importing and exporting between
R and a GIS (i.e. grass) is getting increasingly inconvenient, as
the GIS operations become more an more intermixed
with the analysis. Perhaps the direct integration
of R and Qgis could be a solution (if at least direct
display of R spatial objects in QGis were possible!). But, at this point,
I don't know if this particular operation (dividing the polygon
into two by a line) could have been done in QGis. I used
a commercial vector-based software just because it's the
the tool we normally use and could not put more time
in exploring this issue.



Roger Bivand escribió:
> On Tue, 30 Oct 2007, Agustin Lobo wrote:
>> Is it possible to divide a polygon by a line
>> into 2 polygons?
> No, in general. All computational geometry ends up in having to deal 
> with the type of polygon. A convex polygon is one thing, and can be 
> divided into two parts, but a general polygon may be concave, and the 
> number of parts does not have to be two - the line could cross it 
> multiple times. The approach taken in the Rgshhs function in maptools is 
> to overlay a rectangular box over the polygon(s), and see what comes 
> out, but quite often it isn't two (or in that case a single part within 
> the rectangle).
> Roger
>> Agus

Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Tel. 34 934095410
Fax. 34 934110012
email: Agustin.Lobo at ija.csic.es

More information about the R-sig-Geo mailing list