Created
January 30, 2020 09:31
-
-
Save jarnaldich/151b8b2d33fec7bd22477dad8bbbd8ad to your computer and use it in GitHub Desktop.
Copying map extent to clipboard in QGIS with python #qgis #python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def copy_extent_to_clipboard(separator=';'): | |
ext = iface.mapCanvas().extent() | |
coords = [ ext.xMinimum(), ext.yMinimum(), ext.xMaximum(), ext.yMaximum() ] | |
txt = separator.join([ "{:10.4f}".format(x) for x in coords ]) | |
QgsApplication.clipboard().setText(txt) | |
# Run: exec(open('C:/Users/j.arnaldich/copy_extent_to_clipboard.py'.encode('utf-8')).read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment