SET_LAYER_OPTIONS

The SET_LAYER_OPTIONS command sets the display options for one of more loaded layers. These are the options that you would normally supply when importing a layer. The following parameters are supported by the command. In addition, all of the option parameters for the IMPORT command are also supported for this command.

  • FILENAME - full path or description of loaded layer to set the options for. This can include wildcard characters like '*'. If you specify an empty filename then all layers that have no filename, like generated contours, will be matched. If you leave of the FILENAME parameter entirely or use a '*' wildcard (like FILENAME="*") then all loaded layers will be updated. If you want layers only in some groups, you can add <sub> to the FILENAME. For example, to match all layers in the layer group 'Line Group', use FILENAME="Line Group<sub>*". When running the script in the context of the main map view (including loading a workspace) you can also pass in the value 'USER CREATED FEATURES' to have the 'User Created Features' layer updated or 'SELECTED LAYERS' to have any layers selected in the Control Center.

Shared Import Parameters

These parameters are shared across import and layer options commands to set layer properties.

  • HIDDEN - set to YES to cause this overlay to be hidden from view after it is loaded. The default is to show the overlay.
  • LAYER_DESC - specifies a description to use for the layer when displaying it in the Overlay Control Center. This overrides the default description based on the filename or other information within the file.
  • LAYER_GROUP - specifies the name of the group for the layer in the Control Center. To include multiple layers of grouping put the string <sub> in between levels. For example to make a group with 2 levels of nesting, use LAYER_GROUP="Top Level<sub>Next Level".
  • ALLOW_SELECTION - set to NO to disable selection of features from this layer using either the Feature Info or Digitizer Tools.
  • ALLOW_EXPORT - set to NO to disable export from this layer.
  • LOAD_FLAGS - contains flags for any import options that you were prompted for when loading the file, such as if you have a .tif file that you were prompted to select as elevation or raster. Also things like the coverages and tile sets for VPF layers. To see how to set these if you are writing a script, load a file with the settings that you want in the main user interface and then save a workspace, then examine the IMPORT command in the .gmw file for that file and see how the LOAD_FLAGS were set.
  • METADATA_FILENAME - specifies full path and filename of a file to display the contents of on the Metadata dialog for a layer. The file can be any simple displayable text format, including text and XML.
  • METADATA_URL - specifies a URL to a displayable web file (including HTML web page or XML document) to show on the Metadata dialog for a layer.
  • CODE_PAGE- specifies the code page to use when interpreting text from this layer. By default if the file doesn't specify a code page the current system code page will be used. Use the code page number, or the text UTF-8 (number 65001).
  • ALT_MODE (vector only) - altitude mode specifies how the 3D viewer should interpret z-values in the vector features of an layer, relative to terrain. Altitude mode may also be set in an individual feature, in which case it overrides the layer setting. The following values are supported:
    • UNSPECIFIED - Altitude mode is determined by either the setting in the feature, or if unspecified, the setting in the 3D viewer
    • ABSOLUTE - treat z-values as absolute elevations, ignoring any terrain
    • RELATIVE_TO_GROUND - treat z-values as distances above the terrain
    • RELATIVE_TO_SEA_FLOOR - treat z-values as distances above the sea floor (currently implemented as RELATIVE_TO_GROUND)
    • CLAMP_TO_GROUND - ignore z-values, and clamp the feature to the terrain
    • CLAMP_TO_SEA_FLOOR - ignore z-values, and clamp the feature to the sea floor (currently implemented as CLAMP_TO_GROUND)
    • DEPTH - treat z-values as absolute depths, ignoring any terrain
  • ZOOM_DISPLAY - specifies when the map should be displayed and when it should be hidden based on the display zoom scale. This command will be formatted as a name from the list, below followed by 2 numeric paramters. For example, use ZOOM_DISPLAY="SCALE,25000,0" to have a map display only when zoomed in below 1:25000 scale.
    • ALWAYS - always display the map. The numeric parameters are ignored.
    • PERCENT - display the map when the map bounding box is a certain percentage of the screen size. For example, use ZOOM_DISPLAY="PERCENT,0.10,0" to display the map when its bounding box is at least 10% of the screen size.
    • PIXEL_SIZE - display the map when each display pixel is less than some number of meters in size. For example, use PIXEL_SIZE="SCALE,10,0" to display the map when the current display resolution is 10 meters per pixel (or less/higher resolution).
    • SCALE - display the map when the current display is at or below a certain scale. For example, use ZOOM_DISPLAY="SCALE,25000,0" to display the map when the current draw scale is at or below 1:25000.
    • SCALE_RANGE - display the map when the current display is below a range of scale value. For example, use ZOOM_DISPLAY="SCALE_RANGE,25000,100000" to display the map when the current draw scale is between 1:25000 and 1:100000.
  • PROJ - special Projection Specification type of parameter that specifies the projection to use for the file. This will override any projection information stored in the file.
  • PROJ_NAME (DEPRECATED use PROJ instead) - specifies the name of the projection to use for this file (this will override any projection information stored in the file). This name must have been defined with a prior DEFINE_PROJ command.
  • PROJ_FILENAME (DEPRECATED use PROJ instead)- specifies the name of the projection (.prj) file to use for this file (this will override any projection information stored in the file).
  • PROJ_EPSG_CODE (DEPRECATED use PROJ instead) - specifies the numeric EPSG projection code that defines the projection for this file (this will override any projection information stored in the file). For example, use PROJ_EPSG_CODE=26715 to define a UTM zone 15 projection with NAD27 as the datum and meters as the units.
  • PROMPT_IF_PROJ_UNKNOWN - set to NO if you don't want the user to be prompted to select a projection if the projection of the file cannot be automatically determined.
  • USE_DEFAULT_PROJ - specifies that if no projection can be automatically determined for a layer that the default projection selection should be used rather than prompting the user. Use USE_DEFAULT_PROJ=YES to enable. The default projection uses the first valid option from the following, including a check for linear versus angular numeric ranges:
    • Projection of any files loaded from the same folder
    • Last projection user selected on a projection dialog in this session
    • Current view projection
    • Projection from default.prj in global_mapper.exe path
    • Projection from default.prj in User Settings File path
    • Last projection user selected on a projection dialog in previous session of GM
    • Default UTM/15N/NAD83 projection
  • USE_DEFAULT_POS - specifies that if no position data for a raster layer can be automatically determined that a default position should be chosen so that it displays. Use USE_DEFAULT_POS=YES to enable.
  • PICTURE_POS - specifies that the image should be loaded as a 'picture point' that displays the image when you select the point with the Feature Info Tool. The value should contain the X and Y coordinates (in the projection specified for the layer). For example to place the value at 30N 95W with the projection set as PROJ_EPSG_CODE=4326 you can use PICTURE_POS="-95.0,30.0".
  • LOAD_HIDDEN_PDF_LAYERS - for PDF import, specifies that if no layer prompt is provided that hidden layers should be loaded automatically. Use LOAD_HIDDEN_PDF_LAYERS=YES to enable.

Vector Parameters

  • VIDEO_FILENAME - specifies the full path and filename or URL for a video file to associate with the layer. This video can then be displayed for selected point or line features with a video timestamp.
  • LAYER_FLAGS - specifies various options for the layer (like mesh/3D model display options). This is a bit-mask field that can be specified as an integer or hex number (i.e. 0x3). To build the value, simply add each of the numeric options for the flags you want and then store that number (or convert to hex notation - 0xXXX):
    • 1 - Mesh Display - Wireframe Only - If 1 is added to the value, display textured or colored mesh (3D model) features only using a wireframe (i.e. do not fill them).
    • 2 - Mesh Display - No Wireframe on Zoom - If 2 is added to the value, textured/filled mesh (3D model) features will NOT display a wireframe over the color display when zoomed in far enough that the triangles are large.
    • 4 - Mesh Display - Don't Interpolate Textures - If 4 is added to the value, nearest neighbor rather than bilinear interpolation will be used when sampling the texture for a mesh (3D model). This is slightly faster, but will result in pixelated display when zoomed in.

Vector Label Parameters

The parameters below allow specifying how to create display labels for vector layers.

  • LABEL_FIELD - specifies the name of the attribute field to use as the label attribute for the features in the file. By default the attribute-based labeling will only be applied to those features that don't already have a label, but if the LABEL_FIELD_FORCE_OVERWRITE attribute is set to YES then all features will have their labels replaced. If you want to build the label from multiple attributes, separate them with '>+<' in the file, like LABEL_FIELD='RD_PREFIX>+<RD_NAME>+<RD_SUFFIX'.
  • LABEL_FIELD_SEP - specifies the attribute separator to use when building a label from multiple attributes. This can be any character(s). For example LABEL_FIELD_SEP='-' will insert a dash between each attribute. Use hex codes to add any non-printable characters, such as LABEL_FIELD_SEP='0x20' to add a space.
  • LABEL_CUSTOM_DEF - specifies a custom free-form string describing how to form the display labels for this layer. This can include embedded attribute values as %ATTR_NAME%.
  • LABEL_FIELD_FORCE_OVERWRITE - specifies that the LABEL_FIELD or LABEL_CUSTOM_DEF attribute value should be applied to all feature labels, not just those that don't already have labels. Use LABEL_FIELD_FORCE_OVERWRITE=YES to enable.
  • SHOW_LABELS - specifies whether or not labels are shown for features in this layer, assuming they would be otherwise shown. The default is SHOW_LABELS=YES. Use SHOW_LABELS=NO to disable the display of labels for this layer regardless of other settings.
  • LABEL_PREFIX - specifies the prefix to prepend to attribute-based labels
  • LABEL_SUFFIX - specifies the suffix to append to attribute-based labels
  • LABEL_FORMAT_NUMBERS - specifies whether or not numeric attribute values should automatically have formatting applied to them. This is enabled by default. Use LABEL_FORMAT_NUMBERS=NO to disable numeric formatting and keep numeric values exactly as they are in the attribute list.
  • LABEL_PRECISION - value is an integer indicating the number of decimal digits to use. This applies to numeric labels.
  • LABEL_REMOVE_TRAILING_ZEROS - This removes the trailing zeros to the right of the decimal place in numeric labels. This can be specified by listing the parameter alone, or accepts boolean values.
  • LABEL_USE_SCIENTIFIC_NOTATION - Display the number in scientific notation. This accepts boolean values, or can be called by listing the parameter alone.