5

How to get pixel size of canvas in QGIS? It is possibly by Python. I mean this red rectangle area in the image.

example

1
  • what do you mean with dataframe? If you mean a raster-layer than the pixelsize is in the properties
    – Curlew
    Mar 20, 2013 at 20:33

1 Answer 1

7

You can get those values with this code :

qgis.utils.iface.mapCanvas().size()

This returns a QSize object. You can catch width and height directly with

canvasSize = qgis.utils.iface.mapCanvas().size()    
print("Width : " + str(canvasSize.width()) + " / Height : " + str(canvasSize.height()))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.