When you split one linestring with one point you will get as a result two linestrings, 
thats why your result will be a GEOMETRYCOLLECTION. You can than "explode" it 
with st_dump.


Try the example below (one line and teo points "spliting" it -> 3 linestrings)

select
        st_astext(
                (st_dump(
                        st_split(
                                st_makeline(st_makepoint(0,0),st_makepoint(2,2))
                --              , st_makepoint(1,1)
                                , 
st_multi(st_union(st_makepoint(1.5,1.5),st_makepoint(0.5,0.5)))
                                )
                        )).geom
                )

On Fri, 09 Feb 2018 13:56:10 +0100, Olivier Leprêtre <o.lepre...@gmail.com> 
wrote:

Hi, thanks for your answers,


I didn't interpret well what st_split would do, I thought st_split(line, set of 
n points) would returns n+1 set of lines segments but in fact it returns 2 n 
lines, input line being cut n times. So I have to search another way, likely as 
Nicolas suggested with st_lineLocatePoint and st_lineSubstring, or using 
st_split one point at a time.


Olivier


De : postgis-users [mailto:postgis-users-boun...@lists.osgeo.org] De la part de 
Alexandre Neto
Envoyé : vendredi 9 février 2018 13:31
À : PostGIS Users Discussion
Objet : Re: [postgis-users] splitting a linestring with points


Beware that hitting a line with a point can be tricky in terms of accuracy. 
Unless the point is snapped to one of the line's vertices, if you zoom enough, 
it will not be on top of the line. That may be the reason why you are not 
getting the desired results.


Olivier Leprêtre <o.lepre...@gmail.com> escreveu no dia sexta, 9/02/2018 às 
09:55:

Hi Martin

I hoped but it's doesn't with results from st_collectionExtract(st_Split())

Olivier

-----Message d'origine-----
De : postgis-users [mailto:postgis-users-boun...@lists.osgeo.org] De la part de 
Martijn Meijers
Envoyé : vendredi 9 février 2018 09:15
À : postgis-users@lists.osgeo.org
Objet : Re: [postgis-users] splitting a linestring with points

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 
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
 &utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
      Garanti sans virus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email 
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
 &utm_source=link&utm_campaign=sig-email&utm_content=emailclient>


<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users


---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel 
antivirus Avast.
https://www.avast.com/antivirus

_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users



--
Using Opera's mail client: http://www.opera.com/mail/
_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to