globalmapper.LoadLayerListEx

globalmapper.LoadLayerListEx(str aFilename, GM_LoadFlags_t32 aLoadFlags, str aExtraLoadOptions) GM_Error_t32, GM_LayerHandle_t32, uint32[source]

Loads the given file and returns a pointer to an array containing handles for the opened layers. The number of layers in the array is returned as a uint32. Even when only one layer is opened, the handle will still be returned in an array. Refer to the tutorial page on working with layer handles for more information on how to turn this array pointer into a usable object in Python.

The layer handles can be used in other calls into the library. Each layer handle must be closed by calling CloseLayer when the caller is done using it.

The aExtraLoadOptions value allows you to provide a string containing additional type-specific load options to the load operation. The formats supported for the various import types are specified below.

Supported Extra Load Options

  • Any Format - Format Specification - the type for a layer can be manually specified rather than the automatic detection mechanism used by providing a string for the aExtraLoadFlags parameter than includes the text “LAYER_TYPE=type name here”, such as “LAYER_TYPE=BIL” for a BIL-format file. See the documentation for the TYPE parameter of the IMPORT command in the Global Mapper scripting language to get a list of the valid type names. This is useful if you want to use a non-standard extension for a file type.

  • DBDB-v5 HDF5 Data - specifies flags for loading the DBDB-v5 bathymetry data set, witht he following format: geo,<resolution_index>,<left_lon>,<bottom_lat>,<right_lon>,<top_lat>,<flags>. The <flags> are optional. If set to 1 then data from lower resolution layers than what is specified will not be used when no data at the specified resolution can be found.

  • VPF Data (VMAP, DNC, etc.) - you can specify a comma-delimited quoted list of coverages to load as well as a library name to load if the dht file that you are loading references multiple libraries. For example, to load just the boundary and transportation coverages from a layer, specify a load flags of COVERAGES=”Boundaries,Transportation”. Note that this will also cause the coverage/tile selection dialog to not be shown. You can also supply a list of FACC codes to load in the extra load string. It’s formatted like FACC_LIST=”<FACC_Code1>,…,<FACC_CodeN>”. Finally, if you just want to load either area, line, and/or point features, you can specify that the other types are to be ignored by adding a substring of format FEATURE_TYPE=”AREAS,LINES,POINTS”. Just leave out the types that you don’t want to load, so to just load lines, you would use FEATURE_TYPE=”LINES”. If you want to hide the dialog that shows and just load everything, use COVERAGES=”*”. This works as the coverage names support wildcard (* and ?) characters.

  • Spatial Database - You can specify the name of the spatial database table name and the bounding box for data to be loaded. The format is:

    <table_name>,<minX>,<minY>,<maxX>,<maxY>

The values are separated by commas. <table_name> is the name of the table to be loaded. <minX> and <minY> are the easting/longitude and northing/latitude for the lower, left corner of the bounging box. <maxX> and <maxY> are the easting/longitude and northing/latitude for the upper, right corner of the bounding box. The bounds are assumed to be in the same projection as the table being loaded. If the projection has an angular unit, the values must be in decimal degrees. For example, to load a table called ROADS with data in a geodetic projection (e.g., WGS84), you could use the following:

ROADS,-70.5,40.0,-65.0,45.0

If you want to read the entire contents of a table, specify the name of the table by itself, with no bounds, as shown below:

ROADS

Parameters:
  • aFilename (str) – the file to load

  • aLoadFlags (GM_LoadFlags_t32) – control flags for loading the file

  • aExtraLoadOptions (str) – more controls; see description above

Returns:

Error Code

Return type:

GM_Error_t32

Returns:

The layer handle(s) for the loaded layer(s)

Return type:

GM_LayerHandle_t32

Returns:

The number of layers that were loaded

Return type:

uint32