Feature request #19414

Decoration -> Scale Bar, needs more unit selections

Added by Mingze Jiang almost 6 years ago.

Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:27242


I am a researcher working with Scanning electron microscope (SEM) image. The pixel size of SEM image is ussually several nanometer.

The problem of using qgis to deal with SEM image is the scale bar of decoration can't display the nanoscale probably. Currently, the smallest unit of scale bar is milimeter, which means to display a length in nanoscale, a very long decimal is required.

My solution is to add several else if in source code "qgsdecorationscalebar.cpp" -> QgsDecorationScaleBar::render( const QgsMapSettings &mapSettings, QgsRenderContext &context ).

else if ( myActualSize < 0.00000001 )
myScaleBarUnitLabel = tr( " nm" );
myActualSize = myActualSize * 1000000000;
else if ( myActualSize < 0.00001 ) {
myScaleBarUnitLabel = tr( " um" );
myActualSize = myActualSize * 1000000;

I have this solution in my own build of qgis.It works. I hope these code can be added to published version, which may help the other people who have the same problem.

However, I think this is not ultimate solution. Because my qgis get crash when I try to edit shape in nanoscale, when the shape is complicated. I checked the source code it must be a bug of GDAL. Maybe GDAL can't deal with polygon inside a very tiny extent.

Therefore, I propose two solution:

1. to add a new unit selection (Nanometer) in the Decoration -> Scale Bar, which only have two unit selction currently: Meters|Degree.

Or 2. add a new feature, which allow the user to edit the unit label displayed behind the number. just like in ESRI ArcGIS. Then the user can still use meter, but pretend it's nanometer.

Also available in: Atom PDF