2

In QGis I would like to know how to get the scale of the vue when drawing a new polygon?

The idea is to be able to estimate the quality of the polygons drawn by my colleagues and me and to know which ones can be used for official purpose.

  • The current map scale is always displayed at the bottom of the window; you can copy and paste it in when you enter the attributes. – csk Oct 28 '16 at 17:19
  • "used for official purpose" worries me. GIS is more or less for reference only, and should not be used for data needs that requires metes & bounds or a survey. – MaryBeth Oct 28 '16 at 20:01
  • @MaryBeth sometimes recording data follows a standard methodology and data must be captured within a certain scale, this can be fairly standard for some tasks like evidence based research related to social sciences – SaultDon Oct 29 '16 at 0:47
  • Thanks @SaultDon! I work mostly with engineering diagrams, etc. So the combination of drawing polygons at certain scales and official purposes worried me :) – MaryBeth Oct 31 '16 at 18:02
3

You can do this in QGIS >= 2.18 using field default values.

Under the field properties look for the "Default value" section. Click the button to the right of that.

Switch to the function editor tab and create a custom PyQGIS function like:

from qgis.core import *
from qgis.gui import *

@qgsfunction(args=0, group='Custom')
def map_scale(value1, feature, parent):
    return qgis.utils.iface.mapCanvas().mapSettings().scale()

Hit "Load", and then back on the "Expression" tab enter the expression map_scale()

Now, when you digitize a new feature in QGIS the field will automatically be populated with the canvas' scale!

  • 1
    Just remember that you can also zoom while digitizing. – Matthias Kuhn Oct 29 '16 at 5:12

Your Answer

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

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