Guest User

Untitled

a guest
Jan 18th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. from PyQt4.QtCore import *
  2. from qgis.core import *
  3.  
  4. # Loads Raster.
  5. vrt_path = 'path/to/vrt/file.vrt'
  6. vrt_info = QFileInfo(vrt_path)
  7. vrt_name = vrt_info.baseName()
  8. vrt_layer = QgsRasterLayer(vrt_path, vrt_name)
  9. if not vrt_layer.isValid(): print 'Not valid.'
  10.  
  11. # Gets bounding box and buffers it with whatever value you pass in offset.
  12. bbox = vrt_layer.extent()
  13. buff_bbox = bbox.buffer(offset)
  14.  
  15. # Prints coordinates in console.
  16. print buff_bbox.asWktPolygon()
Add Comment
Please, Sign In to add comment