[GIS] Clipping a vector line shapefile in QGIS based on a raster shapefile

clipgeoprocessingqgis

I have a vector line 'straten' shapefile which I want to have cliped based on raster shapefile "Luchtfoto 2016". Because some streets are running out of tmy raster, I want to have the vector cliped.

enter image description here

I know this in Arcgis but not in QGIS. How can I do this?
Yes I can easily deleted the shapes that run out of the raster, but some lines are just too long and only consists of one segment.

Best Answer

I would probably do the following:

  1. Use the Raster Calculator on your "Luchtfoto2016":

    Raster > Raster Calculator...
    

    And use the following expression:

    Luchtfoto2016@1 = 0
    

    This will save a new raster with all cells equal to zero (this should dramatically speed up the next step).


  1. Use the Polygonize tool on your newly saved raster to convert it to a polygon:

    Raster > Conversion > Polygonize (Raster to vector)
    

  1. Use the Clip tool on your line layer with the new polygon layer.

    Vector > Geoprocessing Tools > Clip
    
Related Question