[GRASS-user] Split polygons with lines

Hi,

I’ve been looking for ways of grass gis splitting a polygon into multiplepolygons with a line shapefile and wondering are there tools in Grass to do this!!

Thanks

···

Le gach dea ghui,

Shane Carey
GIS and Data Solutions Consultant

Hola, no si buscas algo parecido a esto que es en QGIS

dejo el link de acceso al video:

https://www.filemail.com/d/bspgwgmhyxruqcu?&showconfirmation=true

Saludos

Eddison

El dom., 10 mar. 2019 a las 8:39, Shane Carey (<careyshan@gmail.com>) escribió:

Hi,

I’ve been looking for ways of grass gis splitting a polygon into multiplepolygons with a line shapefile and wondering are there tools in Grass to do this!!

Thanks

Le gach dea ghui,

Shane Carey
GIS and Data Solutions Consultant


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

On Sun, Mar 10, 2019 at 3:39 PM Shane Carey <careyshan@gmail.com> wrote:

Hi,

I've been looking for ways of grass gis splitting a polygon into multiplepolygons with a line shapefile and wondering are there tools in Grass to do this!!

Please take a look at
https://grass.osgeo.org/grass76/manuals/v.edit.html

Markus

Thanks Markus, it doesnt seem to do the trick for me unfortunately.
Thanks for your help

···

Le gach dea ghui,

Shane Carey
GIS and Data Solutions Consultant

On 10/03/19 15:39, Shane Carey wrote:

Hi,

I've been looking for ways of grass gis splitting a polygon into multiplepolygons with a line shapefile and wondering are there tools in Grass to do this!!

Does the following correspond to what you are looking for ?

test = polygons
test2 = lines

# patch lines and polygons together
v.patch test,test2 out=test_patched

# transform lines to boundaries
v.type test_patched out=test_patched_bound

# break boundaries at intersections
v.clean test_patched_bound tool=break out=test_patched_bound_clean

# add centroids to new areas
v.centroids test_patched_bound_clean out=final

This can be easily scripted into a small addon module.

Moritz

Hey Moritz,

Thanks for coming back to me. I figured it out with the following script

import processing
polys = QgsVectorLayer(r"C:\Users\shane.carey\Desktop\poly.shp", ‘poly’, ‘ogr’)
lines = QgsVectorLayer(r"C:\Users\shane.carey\Desktop\s1line.shp", ‘lines’, ‘ogr’)
output = r"C:\Users\shane.carey\Desktop\split2.shp"
processing.run(“saga:polygonlineintersection”,{ ‘POLYGONS’:polys, ‘LINES’:lines,‘INTERSECT’:output})

Cheers

···

Le gach dea ghui,

Shane Carey
GIS and Data Solutions Consultant