[postgis-users] st_collect returning more geometries than I want

Richard Greenwood richard.greenwood at gmail.com
Tue Jan 3 06:55:02 PST 2012


Thanks Steve, that looks like what I need.

Best regards,
Rich


On Tue, Jan 3, 2012 at 7:49 AM, Stephen Woodbridge
<woodbri at swoodbridge.com> wrote:
> On 1/3/2012 9:19 AM, Richard Greenwood wrote:
>>
>> This seems so simple that I'm embarrassed to ask, but, putting my
>> pride in my pocket...
>>
>> I want to aggregate two linestrings into one. The endpoint of the
>> first linestring is coincident with the start point of the second.
>> Using st_collect() or st_union() I get a multiLineString with 2
>> geometries. How can I get a single linestring, or a multiLineString
>> with just 1 geometry?
>>
>> I cases where I aggregate linestrings that do not have coincident
>> start/end points I do want multiLineStrings with multiple geometries.
>>
>> I tried the st_dump() "trick" with no better luck:
>>
>>   SELECT label, st_numgeometries(ST_Collect (f.the_geom ))
>>   FROM ( SELECT label, (ST_Dump (wkb_geometry )).geom As the_geom
>>       from road_cl
>>     ) As f
>>   GROUP BY label
>>
>> Basically I'm looking for the opposite of st_multi()
>>
>> Thanks,
>> Rich
>>
>
> Hi Rich,
>
> I think you are looking for:
>
> http://postgis.refractions.net/docs/ST_LineMerge.html
>
> -Steve
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the postgis-users mailing list