[Qgis-developer] split line at specified distance

Giovanni Manghi giovanni.manghi at gmail.com
Wed Jan 25 01:32:19 PST 2017


Hi Pierluigi, buongiorno

> I have some difficulties to figure out how to split line at specific distance from the beginning.
> I need to split a single line into several lines at specific distances.
>
>
> I'm able to get the point at specific distance using the intersection function of QgsGeometry but I'm in trouble on how to create the new geometry.
> I looked at the split function but I'm not sure it could help me.
>
>
> Do you have some code to share on how to split a line into several lines at specified distances?

doing this operation the postgis/spatialite way is tricky because the
st_split function won't work if you don't have a node/vertex where you
need do the split. See for example this workflow

https://mygisnotes.wordpress.com/2017/01/01/split-lines-with-points-the-postgis-way/

I had to use it (does not means that is the best way) to solve a
specific problem here. I used PostGIS because in QGIS/Processing do
not seems there is yet any tool (not even in external providers? I
maybe wrong, I just could not find any) that allow do this operation.

cheers!

-- Giovanni --


More information about the Qgis-developer mailing list