<HTML dir=ltr><HEAD><TITLE>Re: [postgis-users] Splitting a Polygon with a Linestring</TITLE>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2900.3314" name=GENERATOR></HEAD>
<BODY>
<DIV id=idOWAReplyText89807 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>Kevin,</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>that looks neat.  I'll have to remember that one. </FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>I presume if you have a geometry with holes, this would not work.   How would you tackle,   if say you wanted to cut a donut with a line.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>Regina</FONT></DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> postgis-users-bounces@postgis.refractions.net on behalf of Kevin Neufeld<BR><B>Sent:</B> Wed 5/28/2008 1:47 PM<BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B> Re: [postgis-users] Splitting a Polygon with a Linestring<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>Right.<BR><BR>Here's an example splitting a polygon with a line.  Note that the<BR>dangling cutlines outside the polygon are quietly dropped.<BR><BR><BR>SELECT astext(geom )<BR>FROM dump ((<BR><BR>SELECT polygonize(geomunion(boundary(poly), line)) AS mpoly<BR>FROM<BR>   (SELECT 'POLYGON ((1 1, 1 3, 3 3, 3 1, 1 1 ))'::geometry AS poly) AS a,<BR>   (SELECT 'LINESTRING (0 2, 4 2)'::geometry AS line) AS b<BR><BR>));<BR><BR><BR>              astext<BR>--------------------------------<BR>  POLYGON((1 1,1 2,3 2,3 1,1 1))<BR>  POLYGON((1 2,1 3,3 3,3 2,1 2))<BR>(2 rows)<BR><BR>Cheers,<BR>Kevin<BR><BR><BR>James Beaudoin wrote:<BR>> I think the steps below will work but I have one question. I am creating<BR>> an application that allows a user to split a polygon by drawing a<BR>> linestring across the polygon they wish to change. The crossing<BR>> linestring has parts that are outside the polygon and I want to remove<BR>> that before I geomunion. What's the easiest way to do that?<BR>><BR>> - extract the lines that make up the polygon<BR>> - add to this your crossing linestring<BR>> - geomunion the lines together.<BR>> - polygonize the union-ed set<BR>><BR>> Thanks,<BR>><BR>> Jim<BR>> _______________________________________________<BR>> postgis-users mailing list<BR>> postgis-users@postgis.refractions.net<BR>> <A href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>_______________________________________________<BR>postgis-users mailing list<BR>postgis-users@postgis.refractions.net<BR><A href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR></FONT></P></DIV></BODY></HTML>
<HTML><BODY><P><hr size=1></P>
<P><STRONG>
The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
</STRONG></P></BODY></HTML>

<P><hr size=1></P>
<P><STRONG><font size="2" color="339900"> Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper. </p> <p> </font></STRONG></P>