IMPORT

The IMPORT command imports a data file for later use. To determine the proper import parameters, one option is to load the file via the interface and save a workspace. The IMPORT command and parameters will be listed in the workspace file. The following parameters are supported by the command.

  • FILENAME - full path to file to load the data from. This can also be the URL (http: or ftp:) for a file on a web site that you want Global Mapper to download and load. You can include wildcards ('*' or '?') in the FILENAME (v16.0.5. or later) to load all files matching a particular mask. In v17.0.4 or later you can provide workspace or script files (.gmw and .gms) via an IMPORT command rather than using EMBED_SCRIPT.
  • PROMPT_IF_TYPE_UNKNOWN - set to NO if you don't want the user to be prompted to select a file type if the type cannot automatically be determined (useful when looping).
  • SOURCE_URL - specified the URL of the file on the server. If the file specified by FILENAME is not found and there is a SOURCE_URL, the file is downloaded from the URL and saved to the FILENAME location.

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.

SAMPLES

IMPORT FILENAME="P:\21989\input.tif" TYPE="GEOTIFF" \
FEATHER_BLEND_EDGES="64" \
FEATHER_BLEND_POLY_FILE="P:\21989\test.shp" \
FEATHER_BLEND_SIZE="4" \
POLYGON_CROP_USE_ALL=YES
IMPORT FILENAME="C:\data\Gardiner\LiDAR_Elevation.dem" \
TYPE="USGS_DEM" BAND_RANGE="38.700000763,113.900001526,ALL,0" \
SAMPLING_METHOD="BILINEAR" ELEV_UNITS="METERS"
IMPORT FILENAME="C:\data\Gardiner\Imagery.jp2" TYPE="JPEG2000" \
HIDDEN="YES" CLIP_COLLAR="NONE" SAMPLING_METHOD="NEAREST_NEIGHBOR" \
AUTO_CONTRAST="NO" CONTRAST_SHARED="YES" CONTRAST_MODE="NONE" TEXTURE_MAP="NO" TRANSLUCENCY="512"
IMPORT FILENAME="C:\data\Gardiner\Gardiner Roads.shp" \
TYPE="SHAPEFILE" LINE_TYPE="Residential Road" ELEV_UNITS="METERS" \ LABEL_FIELD_FORCE_OVERWRITE="YES" LABEL_FIELD_SEP="0x20"\
LABEL_FIELD="NAME" CODE_PAGE="1252"

This script downloads and loads a list of files:

// Define list of files to download
DEFINE_VAR_TABLE NAME="file_urls"
http://servername.com/file_url1.tif
http://servername.com/file_url2.tif
http://servername.com/file_url3.tif
http://servername.com/file_url4.tif
END_VAR_TABLE
// Import all of the files
VAR_LOOP_START VALUE_TABLE="file_urls" VAR_NAME="%file_url%"
     DEFINE_VAR NAME="filename" VALUE="%file_url%" FILENAME_PIECE="FNAME"
     IMPORT FILENAME="%SCRIPT_FOLDER%%filename%" SOURCE_URL="%file_url%"
VAR_LOOP_END