15

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.

  • I'm not versed with the QGIS API, but would this help? – dassouki Nov 14 '11 at 18:30
  • 1
    yes, QgsRectangle sounds like what i want, but how do I use it?... – vascobnunes Nov 14 '11 at 18:34
  • 1
    I think this is a better example from the pyqgis cookbook. If you get the extents, you can use this to create the vector bound – dassouki Nov 14 '11 at 18:48
8

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

  • 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 5: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 gis.stackexchange.com/questions/187798/… 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 2 '16 at 18:40
7

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.

  • 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 6: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. – user78826 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. – user78826 Jan 12 '17 at 14:44
  • It's called "extract layer extent" in qgis 3+ – chrismarx Apr 2 at 18:47
-1

Actually it does work on later QGGIS versions, the only thing is that you have to manually select that raster from your file directory

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.