[postgis-users] Merge lines

Sufficool, Stanley ssufficool at sbcounty.gov
Wed Oct 7 10:32:26 PDT 2009



> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net 
> [mailto:postgis-users-bounces at postgis.refractions.net] On 
> Behalf Of Picavet Vincent
> Sent: Wednesday, October 07, 2009 4:26 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Merge lines
> 
> 
> Hello,
> 
> > Does this look correct?
> > 
> > select st_linemerge(st_collect(cs1.the_geom))
> > from (
> > 	select the_geom, st_startpoint(cs_s.the_geom) as linepoint
> > 	from mylinetable cs_s
> > 	UNION ALL 
> > 	select the_geom, st_endpoint(cs_e.the_geom) as linepoint
> > 	from mylinetable cs_e
> > 
> > ) as cs1
> > group by linepoint
> > having count(*) = 2
> 
> Be careful with group by linepoint, as it uses the = 
> operator, which works on bounding boxes and not on 
> geometries. The bounding box of a point is not equal to the 
> point itself. This could lead to points being very close to 
> each other being grouped by, while being different. If you 
> want to group by strictly identical geometries, you could do a 
> group by st_asbinary(linepoint)

How would the bounding box on a point be a problem with group by? I am
aware of the classic example of a line 0,0-5,5 and 0,5-5,0 being treated
as same when grouped. But does this really apply to points?

> 
> Hope this helps,
> Vincent
> 
> 
> > 
> > 
> > > -----Original Message-----
> > > From: postgis-users-bounces at postgis.refractions.net
> > > [mailto:postgis-users-bounces at postgis.refractions.net] On 
> Behalf Of
> > > Martin Fafard
> > > Sent: Tuesday, October 06, 2009 11:21 AM
> > > To: PostGIS Users Discussion
> > > Subject: [postgis-users] Merge lines
> > > 
> > > 
> > > Hi
> > > 
> > > Is there a way to merge lines that are contiguous but stop
> > merging at
> > > an intersection?
> > > I have join an image.
> > > Thank you
> > > 
> > > Martin F
> > > 
> > _______________________________________________
> > postgis-users mailing list postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> > 
> _______________________________________________
> 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