Concatenating LineStrings

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Concatenating LineStrings

Jeff Adams-4
This seems like an incredibly simple question, but for some reason I'm coming up blank.

I have a collection of 4 LineStrings, which all touch end-to-end (lines[x].EndPoint == lines[x+1].StartPoint).  I want to make a single LineString out of them.  How do I do it?  Union just gives me a MultiLineString with the four line strings in it.

I could do it by hand by taking all the points and creating a new LineString, but it seems like there must be a built-in way of doing it.  Also I'd prefer some function that would give me a LineString in the correct case, but a MultiLineString if there was a gap in my list of LineStrings.

Thanks,
Jeff





_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Concatenating LineStrings

David Zwiers

Have you tried buffering the resulting multi-linestring by 0?

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Jeff Adams
Sent: August 26, 2008 7:35 AM
To: JTS Topology Suite Development
Subject: [jts-devel] Concatenating LineStrings

 

This seems like an incredibly simple question, but for some reason I'm coming up blank.

I have a collection of 4 LineStrings, which all touch end-to-end (lines[x].EndPoint == lines[x+1].StartPoint).  I want to make a single LineString out of them.  How do I do it?  Union just gives me a MultiLineString with the four line strings in it.

I could do it by hand by taking all the points and creating a new LineString, but it seems like there must be a built-in way of doing it.  Also I'd prefer some function that would give me a LineString in the correct case, but a MultiLineString if there was a gap in my list of LineStrings.

Thanks,
Jeff




_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Concatenating LineStrings

D_Guidi
In reply to this post by Jeff Adams-4
> I have a collection of 4 LineStrings, which all touch end-to-end
> (lines[x].EndPoint == lines[x+1].StartPoint).  I want to make a single
> LineString out of them.  How do I do it?  Union just gives me a
> MultiLineString with the four line strings in it.
LineMerger could be useful?
_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Concatenating LineStrings

Jeff Adams-4
In reply to this post by David Zwiers
I did, that produced an empty geometry.

On Tue, Aug 26, 2008 at 10:39 AM, David Zwiers <[hidden email]> wrote:

Have you tried buffering the resulting multi-linestring by 0?

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Jeff Adams
Sent: August 26, 2008 7:35 AM
To: JTS Topology Suite Development
Subject: [jts-devel] Concatenating LineStrings

 

This seems like an incredibly simple question, but for some reason I'm coming up blank.

I have a collection of 4 LineStrings, which all touch end-to-end (lines[x].EndPoint == lines[x+1].StartPoint).  I want to make a single LineString out of them.  How do I do it?  Union just gives me a MultiLineString with the four line strings in it.

I could do it by hand by taking all the points and creating a new LineString, but it seems like there must be a built-in way of doing it.  Also I'd prefer some function that would give me a LineString in the correct case, but a MultiLineString if there was a gap in my list of LineStrings.

Thanks,
Jeff




_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel



_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Concatenating LineStrings

Jeff Adams-4
In reply to this post by D_Guidi
Thanks, that works!

On Tue, Aug 26, 2008 at 11:42 AM, Diego Guidi <[hidden email]> wrote:
> I have a collection of 4 LineStrings, which all touch end-to-end
> (lines[x].EndPoint == lines[x+1].StartPoint).  I want to make a single
> LineString out of them.  How do I do it?  Union just gives me a
> MultiLineString with the four line strings in it.
LineMerger could be useful?
_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel


_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Loading...