[postgis-users] splitting a linestring with points

Nicolas Ribot nicolas.ribot at gmail.com
Fri Feb 9 01:11:49 PST 2018


Hi,

One very efficient way of splitting lines is to use Linear Referencing
functions (http://postgis.net/docs/reference.html#Linear_Referencing)
st_lineLocatePoint and st_lineSubstring will allow you to cut your
linestring according to points locations along the line.

Nicolas

On 9 February 2018 at 09:14, Martijn Meijers <b.m.meijers at tudelft.nl> wrote:

> st_dump would make it possible, no?
>
> select st_astext((st_dump('MULTILINESTRING((0 0, 10 10), (20 20, 30
> 30))')).geom);
>         st_astext
> -------------------------
>  LINESTRING(0 0,10 10)
>  LINESTRING(20 20,30 30)
> (2 rows)
>
>
>
> On 08-02-18 21:48, Olivier LeprĂȘtre wrote:
>
>>
>> Hi,
>>
>> I want to break a linestring into linestrings by breaking it with a set
>> of points along this line. This appeared easy at first but finally, I tried
>> using st_split(line, set of points) but this returns multilinestrings when
>> I just wants linestrings. I tried several functions like st_dump,
>> st_geometryN, stcollectionextract and so on after st_split but did not find
>> how could I get only rows of linestring splitted by the points acting like
>> blades on the first linestring.
>>
>> Thanks for any help,
>>
>> Olivier
>>
>>
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source
>> =link&utm_campaign=sig-email&utm_content=emailclient>       Garanti sans
>> virus. www.avast.com <https://www.avast.com/sig-ema
>> il?utm_medium=email&utm_source=link&utm_campaign=sig-email&
>> utm_content=emailclient>
>>
>> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/postgis-users
>>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20180209/9a452dcb/attachment.html>


More information about the postgis-users mailing list