6

I have the following .tif file of an area:

enter image description here

I want to make a shapefile out of the contour of the entire area, like the red line in the image below.

enter image description here

Is there a way to do this with QGIS?

I've tried different things such as the contours function, but that doesn't work.

7
  • 1
    Have you tried creating the outline manually?
    – Erik
    Apr 11, 2022 at 9:01
  • @Erik Dear Erik, could you guide me how I can do that in QGIS?
    – sander
    Apr 11, 2022 at 9:06
  • Are you asking how to create a feature in a shapefile?
    – Erik
    Apr 11, 2022 at 9:08
  • @Erik I guess so. I know I can create a new feature (like a new vector dataset) and manually draw the feature around the area. But it needs to be very precise - exactly the shape of the area. I tried it with the extent function but it draws a rectangle instead of the actualshape. Do you have any suggestions? I'm really a beginner at QGIS.
    – sander
    Apr 11, 2022 at 9:16
  • The extent of the image returns the four corners of the image, nothing more.
    – Erik
    Apr 11, 2022 at 9:24

2 Answers 2

9

Use the raster calculator to create an output raster with 1 where the raster equals itself.

Input (nodata shown in light blue):

enter image description here

Calculator:

enter image description here

Output (nodata shown in light blue):

enter image description here

Then polygonize the output raster:

enter image description here

enter image description here

4
  • Hi! Will this not create a lot of polygons instead of only the outer extent?
    – sander
    Apr 11, 2022 at 11:44
  • No. Look at the image, just a single polygon there.
    – user2856
    Apr 11, 2022 at 12:04
  • Thanks a lot! It works perfectly.
    – sander
    Apr 12, 2022 at 9:03
  • Incredible expression, that's the best solution!!!
    – Mayo
    Aug 15, 2022 at 16:41
4

Use menu Raster > Conversion > Polygonize. Merge all the polygons in the output to get one single polygon. If you want a line, use Menu Vector > Geometry tools > Polygons to lines.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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