[postgis-users] Divide 1 Polygon into 2 polygons with a linestring

Stephen Woodbridge woodbri at swoodbridge.com
Fri May 12 12:19:53 PDT 2006


Martin, Baris,

It might be slightly simpler to do if you enforce the constraint that 
the linestring end points are OUTSIDE the bbox of the polygon. In this 
case you can intersect the linestring with the bbox of the polygon (or 
slightly expanded bbox) the construct a polygon based on the 
intersection points, the linestring intersected with the bbox and half 
the bbox based on the intersection. Once you have this, intersection and 
difference of the constructed polygon and the original polygon will give 
you the two pieces you want.

Yes, this is a little bit of work by it is well defined, and fairly 
straight forward and could be all done in a plpgsql stored procedure.

-Steve W

Martin Davis wrote:
> Currently there's no code in JTS which will do this, and not really any 
> sequence of operations which will perform this easily.  The obvious 
> thing to try is to extend the linestring far enough to be able to "bend 
> it around" into a polygon, which you can then use to cut the other 
> polygon (via intersection and difference).  But this is awkward and not 
> a general solution.
>  
> There is a general solution to this, but it requires a more fully 
> developed set of topological classes than are currently in JTS.
>  
> This is probably the most-requested enhancement for JTS.  Hopefully we 
> will get time & funding sometime soon to implement this.
>  
>  
> *Martin Davis, Senior Technical Architect*
> *Vivid Solutions Inc.      /www.vividsolutions.com/*
> /Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5
> Phone: (250) 385 6040 - Local 308 Fax: (250) 385 6046/
> 
>     -----Original Message-----
>     *From:* postgis-users-bounces at postgis.refractions.net
>     [mailto:postgis-users-bounces at postgis.refractions.net] *On Behalf Of
>     *Baris YILMAZ
>     *Sent:* May 12, 2006 11:00 AM
>     *To:* PostGIS Users Discussion
>     *Subject:* [postgis-users] Divide 1 Polygon into 2 polygons with a
>     linestring
> 
> 
>     Hi,
> 
>     I have a problem. I have a polygon and a Linestring. The linestring
>     enters at one point the polygon and leaves at another. In other
>     words, it goes through the polygon. I need to divide the polygon
>     into two pieces, one right to the linestring and one left.
> 
>     Is there any method doing this? Can anyone help me? I searched also
>     in JTS package but I couldn't find anything.
> 
>     I 'll appreciate your help.
> 
>     Best Regards
>     Baris
> 
>     ------------------------------------------------------------------------
>     Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great
>     rates starting at 1¢/min.
>     <http://us.rd.yahoo.com/mail_us/taglines/postman7/*http://us.rd.yahoo.com/evt=39666/*http://messenger.yahoo.com>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list