Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

How to get pixel size of canvas in QGIS? It is possibly by python?example

I mean this read rectangle area.

share|improve this question
    
what do you mean with dataframe? If you mean a raster-layer than the pixelsize is in the properties –  Curlew Mar 20 '13 at 20:33
add comment

1 Answer 1

up vote 4 down vote accepted

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()))
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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