DJH, That's a clever approach. I was going to suggest finding the intersection of the lines and then breaking the input strings coords into two parts, but I think yours is more direct
On Wed, Apr 2, 2014 at 7:15 AM, Harasty, Daniel J <dhara...@appcomsci.com>wrote: > Robert, > > > > This will give you all the cut-up parts: > > > > from shapely.geometry import LineString > > from shapely.ops import cascaded_union > > > > ls1 = LineString([(0,0), (10,10)]) > > ls2 = LineString([(10,0), (0,10)]) > > > > cu = cascaded_union([ls1, ls2]) > > > > print *"cut-up lines:"* > > for item in cu.geoms: > > print item > > > > Note that if you consider ls2 the "cut line", and you **don't** want it > in the output, you'll have to do a bit more work: > > > > print *"cut-up lines excluding the cut line:"* > > for item in cu.geoms: > > if not ls2.contains(item): > > print item > > > > Hope that helps! > > > > DJH > > > > -----Original Message----- > From: community-boun...@lists.gispython.org [mailto: > community-boun...@lists.gispython.org] On Behalf Of Robert Sanson > Sent: Tuesday, April 01, 2014 8:44 PM > To: gispython.org community projects > Subject: [Community] Code for splitting a line with another line > > > > Hi > > > > Does anyone have some Python code for splitting an input line with another > intersecting cut line into two separate lines? > > > > Many thanks, > > > > Robert Sanson > > > > > > > > This email and any attachments are confidential and intended solely for > the addressee(s). If you are not the intended recipient, please notify us > immediately and then delete this email from your system. > > > > This message has been scanned for Malware and Viruses by Websense Hosted > Security. > > www.websense.com > > _______________________________________________ > > Community mailing list > > Community@lists.gispython.org > > http://lists.gispython.org/mailman/listinfo/community > > _______________________________________________ > Community mailing list > Community@lists.gispython.org > http://lists.gispython.org/mailman/listinfo/community > > -- Sean Gillies
_______________________________________________ Community mailing list Community@lists.gispython.org http://lists.gispython.org/mailman/listinfo/community