I'm trying to get the current map scale in PyQGIS, running outside QGIS, with:
project = QgsProject.instance() root = project.layerTreeRoot() canvas = QgsMapCanvas() bridge = QgsLayerTreeMapCanvasBridge(root, canvas) # project.read(projectpath) canvas.center() canvas.extent() canvas.scale()
The center and the extent are just perfect! But the scale is quite different from the one reported at QGIS bottom bar.
Testing the same in QGIS gives the same result.
How do I get the current map scale in PyQGIS (3.x)?
I'm using a project coordinate system, using meters.