28

I have a tiff image file and want to get a polygon with the extent of the tiff.

Is there a direct way of doing this?

Right now I have to convert the image to vector (with gdal_polygonize) and then dissolve the polygons.

Taras
  • 32,823
  • 4
  • 66
  • 137
vascobnunes
  • 5,570
  • 13
  • 49
  • 74

6 Answers6

18

Your question isn't clear. Do you want the 'rectangular' extents of the raster, or the extent of the features in the raster? For the rectangular extent, just use the "Tile Index" under Raster > Miscellanious > Tile Index. If you don't see the Raster menu, you may have to install or enable the GDALTools plugin.

And of course if you aren't tied to doing it in QGIS, you could just use GDAL directly. See gdaltileindex

Darren Cope
  • 6,616
  • 2
  • 32
  • 47
  • 1
    is there a way to create a polygon from the extent of the features in the raster? Not the 'rectangular' extents. – csheth Mar 23 '16 at 05:43
  • You could try converting the raster to vector, then using a 'concave hull' or 'alpha shape' to create the 'extents' although it seems like a lot of work. What is your ultimate goal? Perhaps there's an easier way... – Darren Cope Mar 23 '16 at 20:37
  • would you be able to answer my question http://gis.stackexchange.com/questions/187798/create-polygons-of-the-extents-of-a-raster-in-r Well the ultimate goal will be to crop a dem to the extents within the features, after which run a topographic correction of a landsat image. – csheth Apr 02 '16 at 18:40
13

In QGIS 3.X

In QGIS 3.x it is called extract layer extent. (Thanks to @chrismarx for pointing it out)

Until Version 2.16

If you want only the extent of one image and not the full directory you can go to Vector->Research Tool->Polygon from layer extent here select the image you want the extent and save the output.

G M
  • 2,068
  • 2
  • 21
  • 31
  • 5
    Unfortunately, this does not work with QGIS version 2.16 and later. The function has been reduced to vector layers only. – AndreJ Nov 24 '16 at 06:24
  • Any idea why the functionality has been reduced? As far as I can tell, there's no other direct way to get it. Tileindex can be made to work, but within QGIS it takes an entire directory as input, which will mean moving files into temporary directories in many cases. –  Jan 12 '17 at 13:31
  • @OoO No, maybe you can do a feature request in QGIS – G M Jan 12 '17 at 13:44
  • @G M Yeah, I'll take a look at it. Presumably there's some reason why they dropped it, but I can't imagine what it is right now. –  Jan 12 '17 at 14:44
  • 3
    It's called "extract layer extent" in qgis 3+ – chrismarx Apr 02 '19 at 18:47
  • For a vrt, it creates the rectangular extend, unfortunately – MoritzMoreira Jul 21 '23 at 05:57
3

Despite an @AndreJ's comment under this answer the geolagorithms "Create layer from extent" and "Extract layer extent" are both applicable for rasters and running well on QGIS 3.14.

Taras
  • 32,823
  • 4
  • 66
  • 137
2

If you want the actual boundary around your raster i just did: "Raster pixels to polygons" and then "Dissolve" over the new created polygons.

Ame ZL
  • 125
  • 6
1

If you have no NoData pixels at the edges of your image, then just use "Extract Layer Extent" from the tool box.

If you have NoData values surrounding the actual image which is weirdly shaped and that's the area you want to make into a vector, you can use the Raster Calculator to extract the part of the image you want using "image_name@band"!=NoDataValue and then use Vectorize. That worked for me and was much faster than Vectorize and Dissolve.

Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389
ariamgo
  • 15
  • 5
0

As @chrismarx said in his comment on another answer, the "Extract layer extent" processing routine will create this polygon in QGIS 3. The routine can be found by searching in the statusbar (Ctrl-K, usually bottom left of the screen) or the Processing Toolbox.

Dan Getz
  • 311
  • 2
  • 12