1

I have a raster image (elevation map from DEM) where I have limited the rendered elevation to only 3,500' and higher. I would like to convert the boundary/extent of this rendered image into a vector file, so that I can upload as a shapefile into other programs. I have not been able to do so yet after much Googling and experimentation.

Among other things, I have attempted to clip a large vector by the raster (I get an error saying "Could not load source layer for OVERLAY."). I have attempted to polygonize a two color raster (black and white) and keep only one of those. I believe they are all on the same CRS. I can convert it into a vector, but that converts all the contours, which is not my goal. I only want the boundaries.

Picture below of the raster extent (in white) that I want in vector form.

How do I clip out the black portion?

  • FYI, a layer's extent is always a rectangle. It's bounded by the xmin, xmax, ymin and ymax coordinates. – csk Apr 18 at 18:03
2

You're on the right track by polygonizing the raster. Currently you're trying to polygonize the elevation raster, and the tool is trying to create a separate polygon for every elevation value (ie a polygon for 3500', another polygon for 3501', etc.) You could select and merge all the polygons with values > 3500, but there's a much faster method. First create a raster with only values of 0 and 1 (0 where elevation < 3500, 1 where elevation > 3500). Then you can polygonize that raster, and it will have create a polygon of the area above 3500 feet.

  1. Use the raster calculator with this expression (substitute the name of your raster band):

    "rastername@1" * ("rastername@1" > 3500)
    
  2. Polygonize the output from step 1.

  3. The output should be a polygon layer with two polygons. Select and delete the polygon with 0 value.

  • Thanks for your help. I'm close but haven't yet been able to make that final separation between the two when it comes time to polygonize. When I enter the formula, the result is a raster w/ only 0 and 1. But when I do step 2 and polygonize, both 0 and 1 remain, with the border in the middle. Any idea how to keep only #1? Appreciate it. – jhquest Apr 18 at 19:27
  • Select and delete the unwanted polygon. – csk Apr 18 at 20:59
  • Genius, thank you for your help. – jhquest Apr 18 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.