MapInfo Pro

 View Only

MapInfo Monday: 3 Scalebars for your Layout

  • 1.  MapInfo Monday: 3 Scalebars for your Layout

    Employee
    Posted 10-10-2022 06:32
    Happy #MapInfoMonday!

    In today's post, I'll show you three ways to add a scalebar to a layout window:
    1. Scalebar embedded in a map window
    2. Scalebar linked to map window
    3. Custom scalebar using SmartText
    The starting point is a very basic layout with a frame holding a map window. Just for reference, I have added a Smart Text displaying the cartographic scale of the map. You can find this in the Text drop down in the Insert group on the Layout tab in MapInfo Pro v2021. It will load the Smart Text aliases from the SmartTextAliases.xml file and show these in the Text dropdown for easy access.

    Scalebar embedded in a map window

    The first option is to use the scalebar that you also can embed in a stand-alone map window.

    To do this from a map window embedded into a layout, you first need to activate the map. I normally double-click on the frame that holds the map window to activate it. You can also use the context menu by right-clicking on the frame or click on the frame with the Alt key held down.

    Once you have the map activated - it will now appear with a blue border - you can work with it like any stand-alone map window.

    To add a scalebar, go to the Map tab, and from the Add to Map dropdown select Scalebar.

    You will now be asked to configure the scalebar via two dialogs.

    First, you need to configured the general adornment through the Create Adornment dialog. This controls for example the position of the scalebar.

    Next you will have to configured the scalebar itself via the Create Scale Bar dialog. Here you can control the Dimensions of the scalebar, the Bar Type and color, and whether you want it to include a text with the Cartographic Scale. You can also add a background to the scalebar to make it stand more out against the content of your map.

    The result could look like this

    You can right-click the scalebar in the map window and modify it or delete it, and you can change it's position by dragging it to a different location too.

    This option is quite easy to use but often users would want the scalebar to appear outside of the map window to not take up space from the map itself. If that's what you are looking for, the next option might suit you better.

    Scale bar linked to map window

    The other option is to use the Scalebar addin, and create a scalebar that is linked to the map.

    From the Layout tab, select Scalebar in the Insert group. If you do not see the Scalebar option, make sure that you have the Layout Scalebar addin loaded.

    In the dialog Create Scalebar, you can configure the scalebar. First, you want to make sure that it gets linked to the right map window in case you have multiple map on your layout page. Then set the Bar Length and Bar Height, and select a Scalebar Style from the list.

    One benefit of this scalebar type is that you can change the text used for the distance unit. Depending on your language version of MapInfo Pro this text will change. If you are using an English version of MapInfo Pro, you can always change the text to a different language, or use an abbreviation like "m" for meters. Do note that you should not use this as a way to change the distance units from meters to feet. You will have to change the distance units of the map in this case.

    The scalebar is created in its own frame. This gives you the option to place it where ever you want. On top of the map or below it. Below you can see an example where I have placed it below the map window frame on the layout.

    When you save this as a workspace, you will notice that MapInfo Pro creates a subfolder in the folder where the workspace is saved. If your workspace is named Denmark.wor, the folder will be named Denmark_CustomFrames. This folder contains the settings saved by the addin to be able to create the scalebar when the workspace is loaded.

    Custom scale bar using SmartText

    A final option is to create your own scalebar and use a SmartText expression to calculate the map distance for the given length of the custom scalebar.

    In order to calculate the distance in your map, you need to know the scale. For metric values, you multiple the scale in cm with the scale in meters to get to the distance on the map in meters.

    And example: You scalebar is 10 cm long. The scale of your map is 1 cm to 2500 m. The formula is: 10 * 2500 = 25 000. This means that 10 cm on the map equals 25 000 meters in the real World.

    The SmartText expression would look like this for 10 cm long scalebar:
    $mb{10*MapperInfo(LayoutItemWinID(CurContext(1), 1, LAYOUT_ITEM_TYPE_MAPPER), MAPPER_INFO_SCALE)} meters

    You may want to add some rounding to the expression to get rounded numbers and maybe also format the result to get grouping digits added too:
    $mb{FormatNumber$(Round(10*MapperInfo(LayoutItemWinID(CurContext(1), 1, LAYOUT_ITEM_TYPE_MAPPER), MAPPER_INFO_SCALE),10))} meters

    And here's how the custom scalebar could look. I'm sure you can come up with a far more good looking example.

    Which scalebar do you prefer to use n your layout, and why?

    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------