Fairly new to SE, but trying to be as active as I can and just wanted to make sure of what I'm doing.

A few days ago I answered Changing to alternate label if first label does not fit in QGIS?. The answer involved creating a QGIS custom expression that simply took a map's scale, a given font size, and a feature and estimated whether a label would fit.

Subsequently, it became clear that the asker wanted to use the expression in an attribute table in a print composer. In that context, the qgis default variable @map_scale doesn't work.

In attempting to find a solution, I realized that's really a separate question:

How do you get the scale of a given composer map item in a way that allows you to use it in an expression?

The answer was already quite long, and for many people stumbling upon the first question that additional info would be unnecessary. So I created and answered the second question as Getting extent of composer map in PyQGIS? and linked to it in the original answer.

Was that the correct thing to do, or should I have added that to the original answer in its entirety?

  • 1
    technically I also wanted to use it in print composer :-)
    – Ian Turton Mod
    Commented Jan 31, 2017 at 8:44

2 Answers 2


I think that what you have done is exactly what is best for the site, and for future visitors to either of those questions.

Imagine a future visitor coming to look for the answer to just one of those questions. They can now find the question more easily because each is titled differently, and once found they have the answer "instant-like" without having to disentangle two answers to two questions mashed into one.

Replacing convoluted Q&As with clear answers to clear questions, or avoiding their creation, is what I believe to be the highest priority of this and all Stack Exchange Q&A sites.


I think you did the right thing by creating another post. Just so you know, we support asking and answering your own questions. Especially if it isn't relevant for the first post.

You must log in to answer this question.