Global Mapper v26.0

Gm_sym file format

We recently purchased the Global Mapper SDK and I'm working on adding some symbols to the map through the use of the gm_sym file. I found the square example online and it works fine but I'd like to expand on that. From what I've read, the best approach is to export symbols from Global Mapper and look at the output. I don't think we have access to that so I'm wondering if there is any other way to find information about the format / schema of the gm_sym file. I'm new to this product, so if there's a way for us to use Global Mapper to do this I'm certainly open to that, I just think that we only have license for the SDK.

Thanks!

Answers

  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User

    The .gm_sym extension is used for vector symbols in a simple text format. Are you wanting to add custom vector symbols or just custom symbols based on some image format (i.e. .ico, .png, .bmp, .etc)?

    In the SDK, you would use the GM_AddCustomSymbol function to add a custom symbol based on some type of supported file (image or vector). Then you can reference that symbol by name when specifying point styling.

  • I'd like to use the vector symbols since they look better when scaled (as opposed to a bitmap). I was able to use the square sample file, but we have other objects like circles (filled and empty) and other shapes that we use. Since I'm building the symbol (gm_sym file) by editing it as a text file, I'm wondering if there's a schema specification or sample files available.

  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User

    The help for loading a text file has some format and style samples. See https://www.bluemarblegeo.com/knowledgebase/global-mapper-23/Loading_Generic_ASCII_Text.htm .

    Here's a couple of samples for vector symbols that we have built in to our code:

    static const char* sGeologySymbolDef_VertBedding =

      "PEN_STYLE=SOLID\n"

      "PEN_COLOR=RGB(0,0,0)\n"

      "PEN_WIDTH=1\n"

      "-7,0\n"

      "7,0\n"

      "\n"

      "PEN_STYLE=SOLID\n"

      "PEN_COLOR=RGB(0,0,0)\n"

      "PEN_WIDTH=1\n"

      "0,3\n"

      "0,-3\n";


    static const char* sGeologySymbolDef_Arrow =

      "PEN_STYLE=SOLID\n"

      "PEN_COLOR=RGB(0,0,0)\n"

      "PEN_WIDTH=1\n"

      "FILL_COLOR=RGB(0,0,0)\n"

      "0,5\n"

      "0,-1\n"

      "0,-5\n"

      "\n"

      "CLOSED=YES\n"

      "PEN_STYLE=SOLID\n"

      "PEN_COLOR=RGB(0,0,0)\n"

      "PEN_WIDTH=1\n"

      "FILL_COLOR=RGB(0,0,0)\n"

      "FILL_STYLE=Solid Fill\n"

      "-2,-1\n"

      "0,-5\n"

      "2,-1\n";

    For a circle shape, you would just provide enough points in a line to represent a circle at a large enough scale. Another option it to add a point feature to the .gm_sym file with a SYMBOL attribute defined using one of the DOT_CUSTOM_xxx or DOT_EMPTY_CUSTOM_xxx symbols with size and color specified. Those custom shapes are drawn dynamically so they scale like a vector shape.

    SYMBOL, POINT SYMBOL, POINT_SYMBOL –if this value matches one of the following values, that symbol will be used for the point feature, attribute names are ignored for line features. The symbol name should either exactly match one of the symbol names in Global Mapper, or be in one of the following forms:

    • DOT_CUSTOM_<SIZE>_<RED>_<GREEN>_<BLUE>
    • DOT_EMPTY_CUSTOM_<SIZE>_<RED>_<GREEN>_<BLUE>
    • SQUARE_CUSTOM_<SIZE>_<RED>_<GREEN>_<BLUE>
    • SQUARE_EMPTY_CUSTOM_<SIZE>_<RED>_<GREEN>_<BLUE>
    • VERT_BAR_CUSTOM_<SIZE>_<RED>_<GREEN>_<BLUE>
    • CROSS_CUSTOM_<SIZE>_<RED>_<GREEN>_<BLUE>
    • DIAG_CROSS_CUSTOM_<SIZE>_<RED>_<GREEN>_<BLUE>
    • STAR_CUSTOM_<SIZE>_<RED>_<GREEN>_<BLUE>
    • STAR_EMPTY_CUSTOM_<SIZE>_<RED>_<GREEN>_<BLUE>
    • TRIANGLE_CUSTOM_<SIZE>_<RED>_<GREEN>_<BLUE>
    • TRIANGLE_EMPTY_CUSTOM_<SIZE>_<RED>_<GREEN>_<BLUE>
    • DIAMOND_CUSTOM_<SIZE>_<RED>_<GREEN>_<BLUE>
    • DIAMOND_EMPTY_CUSTOM_<SIZE>_<RED>_<GREEN>_<BLUE>

    Where the <SIZE> value is the radius in pixels of the dot or square or size of the cross or bar, and the <RED>, <GREEN>, and <BLUE> values represent the color to use.

  • Thanks for your help...I'll take a look and see how it goes.

  • This doesn't work, but I figured I'd post my gm_sym file contents to see if there's something obvious here:

    CLOSED=FALSE

    PEN_STYLE=SOLID

    PEN_COLOR=RGB(255,0,0)

    PEN_WIDTH=2

    SYMBOL=DOT_CUSTOM_10_0_255_0

    I expect that I'm not using the "Symbol" attribute right, I'm just not sure how that should be specified.

  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User

    If all that you want is to draw a circle of a custom size, you don't need a .gm_sym at all, you can just set the symbol for the point feature to have a name like 'DOT_CUSTOM_10_0_255_0'. You would only need a .gm_sym if you wanted a vector symbol that had multiple components, like line segments along with the point.

    That said, your .gm_sym needs to have some kind of coordinates for each piece. These are in pixel space with (0,0) being the location where the symbol is centered. So a custom dot symbol at the point location would be:

    SYMBOL=DOT_CUSTOM_10_0_255_0

    0,0

  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User

    Note that there shouldn't be blank lines within a feature, that's just the forum formatting. There would be blank lines between different 'features' that make up the vector symbol.

  • I think I'm getting closer...I hope, anyway :) I put a .gm_sym file together with these contents:

    SYMBOL=DOT_CUSTOM_10_0_255_0

    0.0

    But it still can't read that in. Do I need anything else in the file or should those two lines handle it all? I think this is the direction we'll probably take (keep the symbols in separate files).

  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User

    You need to use a comma in your coordinates, it looks like you just have one coordinate with a value of '0.0'. You need '0,0'.

    That should be all that you need to add a custom symbol with that shape. However, you don't need a separate custom symbol if you are just drawing a point feature with a symbol like that. You can just change the symbol of a given point feature (a similar thing can be done for point types using GM_SetPointFeatureClassDrawStyle) by doing the following:

    GM_PointStyle_t thePointStyle;

    GM_LayerHandle_t32 theLayerHandle; // this should be the layer handle the point is in

    uint32 thePointIndex; // this should be the index of the point in the layer to modify (maybe you loop over these)

    GM_Error_t32 theErr = GM_GetPointFeatureDrawStyle( theLayerHandle, thePointIndex, &thePointStyle );

    ASSERT( GM_Error_None == theErr );

    thePointStyle.mSymbolName = "DOT_CUSTOM_10_0_255_0";

    theErr = GM_SetPointFeatureDrawStyle( theLayerHandle, thePointIndex, &thePointStyle );

    ASSERT( GM_Error_None == theErr );

  • I should have copied and pasted - that did fix the problem partway. I was able to set the symbol of the point feature in the code and see the symbol on the map, but if I try using it in a .gm_sym file nothing shows up although I don't get any errors. I'm using this file:

    CLOSED=TRUE

    PEN_STYLE=SOLID

    PEN_COLOR=RGB(255,0,0)

    PEN_WIDTH=2

    FILL_STYLE=SOLID

    FILL_COLOR=RGB(0,255,0)

    -5,5

    5,5

    5,-5

    -5,-5

    SYMBOL=DOT_CUSTOM_10_255_0_0

    10,10

    I can see the square just fine but the dot doesn't show up. I've also tried a file with just this and nothing shows up then either:

    SYMBOL=DOT_CUSTOM_10_0_255_0

    0,0

  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User

    I've investigated and discovered that points embedded in custom vector symbols are not actually supported! Only line and area features inside the custom vector symbol definition are used.

    I am updating the code now so that a custom symbol can embed other point symbols.

  • That sounds great! This will give us a good path toward using vector images for our symbology provided the performance is on par with other image types.

  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User

    I have completed adding support for point features inside of custom symbols. With the new software, if you add the attached .gm_sym file you get a filled blue box with a red border and green dot inside of it.

    Note that for the 'CUSTOM' symbols, the size is the radius of the feature, so a size of 10 will create a dot 20 pixels across and tall. You would need to either make your box larger or reduce the size of your DOT_CUSTOM. As it is now, your dot covers up the box entirely. The attached sample made a larger box and smaller dot so they are obvious to see.

    If you are using the v23 SDK, I can put a build up somewhere so that you can try out the new feature.


  • I am currently using v23, so I'd be glad to try out a new build sometime.