MapInfo Pro

 View Only

MapInfo Monday: Combining Line Styles on Layers

  • 1.  MapInfo Monday: Combining Line Styles on Layers

    Employee
    Posted 08-07-2023 04:42
    Edited by Peter Møller 08-07-2023 04:43

    Happy #MapInfoMonday

    I wrote this article to suggest a couple of solutions to a question raised on MapInfo-L, the mailing list for MapInfo.

    "When drawing PLine objects with a pen that has endpoints, the middle of each line segment is always drawn black but the end nodes are shown in the color specified. So for example picking a simple PLine with Pen(2, 2, BLUE) we get a line completely blue as expected.  But if I use Pen(2, 80, BLUE) the dots at the segment ends are blue but the line connecting them is black.

    Is there a way to change this behavior? Especially on a per-PLine basis, not by modifying some sort of global default."

    The MapInfo Line Styles are stored in the MapInfow.pen file and can get modified with a dedicated tool, MapInfo Line Style Editor. The issue with changing the line styles is that you need to ensure that all users get the changed file to be able to see your new line style.

    I would recommend doing this a different way: Layer Overrides.

    As we have discussed earlier, layers in MapInfo Pro can get rendered in three ways: using the style saved with each object in the table, using a thematic, and using a layer override.

    The line style to be used is found in D20.

    If you select it and change the color, you quickly realize that the color of the line connecting the dots stays black.
    The solution to this is to combine two line styles: One with the blue dots at the ends of the line ad a second that just has a blue line.
    You can do this in two ways using a layer override.
    You can use the simple method of having your layer twice and assigning each style to one of these two layers or you can use the Stacked Line Style option and create a stacked style combining the two line styles for a single layer.
    I would recommend using the Stacked Styles approach as this would let you stick to one layer and so one legend too.
    To configure a Stacked Style, you will have to enable this for the layer either through the Style tab when selecting the layer in the Layer List or through the Layer Properties dialog.
    Below you can see the result for both options shown in two maps.
    Now this of course only works when all the records in your layer can be drawn with the same style. If your table holds different types and they have to be rendered using different styles, you need to use a different approach.
    You can either have your layer as many times as you have types and use the Layer Filter option to control which types are shown for each layer and then set the style for each layer.
    My preferred method would however be to use two thematic maps: One for the dots at the end of the lines, and another for the color of the line connecting the dots.



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