Feature #575

New Application Barscale

Added by Laszlo Kestay over 7 years ago. Updated about 6 years ago.

Target version:
Software Version:
Test Reviewer:


Need an application to create barscale for different projections

Related issues

Related to ISIS - Feature #1352: Desire to regain full functionality of the PICS barscale program Acknowledged
Related to ISIS 2 Ports - Feature #220: ISIS 2 applications to be ported to ISIS 3 Acknowledged


#1 Updated by Stuart Sides about 7 years ago

This is both an internal and external request. The external support board URL is:,3245.0.html

#2 Updated by Stuart Sides about 7 years ago

Changed to acknowledged so it gets back in the queue

#3 Updated by Jeff Anderson over 6 years ago

Make sure that we are doing what the general community is hoping for

1) Most people would expect this program to create a one dimensional bar indicating distance within an image. That would be very useful if projections were equidistant. It would work so long as the images have small lat/lon coverage.

2) The old ISIS2 barscale program created a very specialized graph which represents scale at different latitudes. This can be observed on maps in the hallway. Annie, Bonnie, and Donna have requested this program many times.

#4 Updated by Janet Barrett over 6 years ago

I have spoken to Chris Isbell (the original author of the bar scale program in PICS) and have looked at the bar scales on the maps in the hall way. The program is very dependent on the projection of the map and I intend to maintain the functionality of the original program.

#5 Updated by Janet Barrett over 6 years ago

IMPACT This is a new program and will not impact any other parts of ISIS.

#6 Updated by Tammy Becker over 6 years ago

Q2S4 Task: The simple version is scheduled for Q2 (<20 hour estimate)

The expanded/robust version would be considered a "Q2EE Task" (extra effort/exceptional)..this version should probably be posted in a separate mantis ticket after discussion with Laz and evaluation of resources.

#7 Updated by Laszlo Kestay over 6 years ago

I made a new ticket (1352) for the full PICS type of barscale.

#8 Updated by Laszlo Kestay over 6 years ago

For the simple barscale, we want to specify:
1. where the scale is calculated (default to center of image)
2. length of the bar (default to 1 km)
3. where the bar scale should appear by giving the line/sample of the lower left corner
4. if the background is white or black (default white).

5. whether to print the scale above the bar

It should use the USGS standard for what a bar scale looks like. See
But only use the metric units. Scale should be in either METERS PER PIXEL or PIXELS PER DEGREE

Enhancement is to pad the image with space at the bottom to add the scale bar instead of paste onto the image.

#9 Updated by Christopher Isbell over 6 years ago

Hello, I am interested in this application and note the following:
- I'd be glad to review the program/output.
- As related, I continue to support the possibility of development of some type of "vector library" within ISIS. That is, generation of some type of vector file (e.g. EPS) output that could be then utilized in both vector (e.g. Adobe, ESRI, etc) and raster (e.g. ISIS, etc) applications. This would be relevant for barscale, grid, and any other existing or eventual "drawing" applications (points, curves, symbols, etc).

#10 Updated by Janet Barrett over 6 years ago

I now have a barscale program that is ready for user testing. I am still working on the documentation, but you are welcome to read what I have so far and make suggestions for improvement. The barscale program can be used by setting your isis to /work/projects/isis/latest/m00575/trunk/isis. The program has all the options that were requested: 1) where to calculate scale (PIXRES parameter), 2) length of the bar scale (UNITS, LEFTLIMIT, LEFTSEGS, RIGHTLIMIT, RIGHTSEGS parameters), 3) lower left corner line/sample of bar scale in image file (CORNERLINE, CORNERSAMPLE parameters), 4) set background to black or white (BACKGROUND parameter), 5) where to print text in relation to bar scale (TEXTLOC parameter), 6) option to pad the image with bar scale (PADIMAGE, PLACEMENT parameters).

I will continue to modify the documentation and add links to visual examples. Let me know of any input you have. Thanks.

#11 Updated by Janet Barrett over 6 years ago

I forgot I had a question: Do you want the smaller segments on the right hand side of the bar scale to be labelled? For example, if you set RIGHTLIMIT to be 20 kilometers and want it to be divided into 4 segments, do you want each segment to be labelled (5, 10, 15, 20)? Right now the program only labels the maximum measurement (20).

#12 Updated by Laszlo Kestay over 6 years ago

Hello Janet!
I've made a folder /work/users/laz/ISIStesting/barscale/ with some files in it.

I'm not sure what I'm doing wrong, but when I try to write onto the image with SL=13000 and SS=500, I don't see anything on the resulting image (bar1.cub; bar4.cub). The ones on the padding look fine, but there needs to be a way to specify the equivalent of font size or height. The bar is too small to see when zoomed out.

We could lose the left side of the scale bars.

Labels on the segment boundaries would be nice, but not essential.

#13 Updated by Janet Barrett over 6 years ago

Hi Laz,

I am making a few adjustments to the program. I was looking at the grid program and it lets you specify the line width and line dn value as well as the dn to use for the background. Allowing the user to provide a line width in pixels rather than specifying a DPI would give you more flexibility in how the scale looks on your image. The line width would refer to the width of the line that bounds the scale bar. The width of the horizontal line used to make adjacent segments more readable is twice the width of the bounding line. I will also add an option to specify the font height in pixels.

I think I was trying to follow the USGS standards too closely, but they are set up for a vector file that can resize automatically and keep everything in direct proportion to one another. These changes will be ready for you by Monday.

#14 Updated by Laszlo Kestay over 6 years ago

Thank you Janet!
I think I forgot to also say this is very cool and I am really looking forward to using it even for my LPSC posters!

#15 Updated by Janet Barrett over 6 years ago

Hi Laz,

I just talked to Jeff about the barscale program and he agrees that I should get rid of the DPI option and just let the user give the height they want the bar scale to be (in pixels) as well as the height of the font (in pixels). This will give the user a lot of flexibility in getting the bar scale to look right for their particular situation. I am also going to allow the user to specify the DN values to use for the background and for the line color. These changes make use of the code I have in place, so it won't take long to get these changes working for you.

#16 Updated by Janet Barrett over 6 years ago

I have finished modifying barscale so that you can specify the height of the bar scale in pixels and the height of the font in pixels. I have built the program so you can run it from any of the following machines: astrovm1, astrovm2, astrovm3, or prog6. You will need to setisis to /work/projects/isis/latest/m00575/trunk/isis to use the software.

I ran barscale using the following parameter settings and got reasonable results:


One thing to note is that the TEXTHEIGHT is interpretted as the font height and doesn't mean that the letters/numbers will be exactly that number of pixels high. In fact the height of your text will only be about 75% of what you specify. This is because of the way fonts are defined. Each font has a certain number of pixels devoted to the ascent above the baseline and the descent below the baseline.

If you don't think that the left side of the bar scale will be needed, then I can remove that option (LEFTLIMIT, LEFTSEGS). Let me know if you have any problems or suggestions. Thanks.

#17 Updated by Laszlo Kestay about 6 years ago

Hello Janet!
I think this is good to go. My only suggestion is to make the default pixel size something greater than 10, maybe 20. Looks really good at 100!

#18 Updated by Laszlo Kestay about 6 years ago

Looks good!

#19 Updated by Janet Barrett about 6 years ago

Thank you Laz. I'll change the default pixel size to 50 and get it checked in for the release. Thanks for your help in making it a better application.

#20 Updated by Janet Barrett about 6 years ago

Update on barscale: In order to get barscale into the release, some low-level ISIS files needed to be changed to allow access to the Qt GUI environment from programs run outside the GUI environment. Without these changes, barscale would cause a segmentation fault when run from the command line. There will be some slight differences in the font used when running the program from the GUI versus running the program from the command line. This is a result of the program not having the ability to modify certain properties of the font (such as antialiasing) when it is run outside of a GUI environment.

Also available in: Atom PDF