[postgis-users] ST_Split with Multilinestring

Birgit Laggner birgit.laggner at thuenen.de
Wed Jun 15 01:01:11 PDT 2016


Hi Marcin,

thanks for your reply. I don't think, that will provide the results I am 
looking for. I am deliberately aggregating all intersecting lines with 
ST_Union because otherwise the query would result in several collections 
per polygon, each collection containig the st_split result for one of 
the intersecting lines (blades). But I want the polygon cut with all blades.

Currently I am trying Marcone's suggestion (although I cannot imagine 
why this should solve anything - but you never know until you try, right?).

So, thank you both, Marcin and Marcone!

Regards,

Birgit

Am 15.06.2016 um 09:24 schrieb Marcin Mionskowski:
> On Tue, 14 Jun 2016 15:37:40 +0200, Marcone <marconeperes at gmail.com> 
> wrote:
>
>>
>> 2016-06-14 9:52 GMT-03:00 Birgit Laggner <birgit.laggner at thuenen.de>:
>>> I would like to use the ST_Split function to split polygons from one
>>>    table with all intersecting lines from another table. Unfortunately,
>>>    I get the following error:
>>>
>>>      ERROR: Splitting a Polygon by a MultiLineString is unsupported
>>>
>>>    SQL Status:XX000
>>>
>>>      This is my query:
>>>
>>>      select betr_id, (cut).path[1], (cut).geom from (select betr_id,
>>>    st_dump(st_split) as cut from (select a.betr_id, ST_Split(a.geom,
>>>    st_union(b.geom)) from p_sam.nihb_2013_convex_hull_betr a left join
>>>    p_sam.ni_dlm13_aaa_gew_sie_ver_l b on st_intersects(a.geom, b.geom)
>>>    group by a.betr_id, a.geom) sel1) sel2;
>>>
>>>      The Manual contains the following info regarding this problem:
>>>
>>>      "The function supports splitting a line by (multi)point, 
>>> (multi)line
>>>    or (multi)polygon boundary, a (multi)polygon by line."
>>>
>>>      This might mean that I would be able to split a line by
>>>    multilinestrings, but a polygon only by single linestrings - is that
>>>    correct? Does anyone has a suggestion how I could work around this
>>>    problem (aside from looping the ST_Split with some function, DO
>>>    block or pgScript after selecting all intersecting linestrings per
>>>    polygon)?
>>>
>>>      Thanks a lot for any helpful suggestions!
>>
>> I'm not sure if I understand your problem, but try use 
>> ST_Split(st_multi(a.geom),
>>    st_union(b.geom)). I'm not test this, but I think that will solve 
>> your problem.
>>
>> Best regards.
>>
>>
>>
> Have you tried to ST_Dump multilinestrings first?
> Using CTE this could look like:
>
> with
> a as ( --polygon
>     select ST_Buffer(ST_GeomFromText('POINT(100 90)'), 50) a
>     ),
> b as ( --multilinestring
>     select ST_Union(
>         (select ST_MakeLine(ST_MakePoint(10, 10),ST_MakePoint(190, 
> 190))),
>         (select ST_MakeLine(ST_MakePoint(191, 191),ST_MakePoint(200, 
> 200)))
>     ) b
>     ),
> c as ( --multilinestring dump -> 2 separate linestrings
>     select (ST_Dump(b)).geom c
>     from b
>     )
>
> SELECT ST_AsText(ST_Split(a, c))
> from a,c
> where ST_Intersects(a,c)
>
> Intersection check is done here on line parts.
>
> Regards
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-users



More information about the postgis-users mailing list