Last active
September 5, 2018 19:36
-
-
Save brianbancroft/148b854f5918ede51e79e8bf12a30998 to your computer and use it in GitHub Desktop.
Get bounding boxes for all CMAs in Canada using QGIS
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
bounding_boxes = [] | |
features = iface.activeLayer().selectedFeatures() | |
for feature in features: | |
bounding_boxes.append({ | |
'city': feature.attributes()[2], | |
'max_x': feature.geometry().boundingBox().toRectF().topRight().x(), | |
'max_y': feature.geometry().boundingBox().toRectF().topRight().y(), | |
'min_x': feature.geometry().boundingBox().toRectF().bottomLeft().x(), | |
'min_y': feature.geometry().boundingBox().toRectF().bottomLeft().y() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment