1

My QGIS 2.8.2 standalone app's mapCanvas fills a central widget with a fixed quadratic size x=y=1000 pixels. When I set the mapCanvas extent() to an area defined quadratic as well given by a QgsRectangle in UTM coordinates, it happens that the extent() gets wider then appropriate. The y-axis fits well. The mapScale() has a significant to great value (about 20% to both sides). The only feature I want to show at this time is a polygon reflecting the extent (kind of background), so this mis-fit is very obvious.

After the first scaleChanged() event, eg. zooming in and out again, the extent() reflects the correct value with width equal to height, and the scale() is correct as well.

Has this something to do with the 5% extra on the extent or with the initial view (without any features)? How can I set the map extent such that it fits well into the widget without any extra white spaces?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.