Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt4.QtCore import *
- from qgis.core import *
- # Loads Raster.
- vrt_path = 'path/to/vrt/file.vrt'
- vrt_info = QFileInfo(vrt_path)
- vrt_name = vrt_info.baseName()
- vrt_layer = QgsRasterLayer(vrt_path, vrt_name)
- if not vrt_layer.isValid(): print 'Not valid.'
- # Gets bounding box and buffers it with whatever value you pass in offset.
- bbox = vrt_layer.extent()
- buff_bbox = bbox.buffer(offset)
- # Prints coordinates in console.
- print buff_bbox.asWktPolygon()
Add Comment
Please, Sign In to add comment