Global Mapper v25.0

Script to load hydrographic data from DNCs (Digital Nautical Charts)

agenteh2o
agenteh2o Global Mapper User
edited May 2011 in Vector Data
I am hoping someone might be able to help me load the vector hydrographic data from all VPF DNCs (Digital Nautical Charts). Currently I can load the DHT or individual LHTs but the import dialog forces me to manually select the Hydrography check box for each and every subfolder (incl. all harbours and approaches). I am wanting to just batch load only the bathymetric contours from the DNCs of an area. Is this possible? Thanks.

Comments

  • global_mapper
    global_mapper Administrator
    edited March 2011
    You would currently need to write a script to do this. You could use the DIR_LOOP_START and DIR_LOOP_END commands to loop over all of the 'dht' or 'lht' files in a directory tree and load them with a LOAD_FLAGS parameter set to just load the Hydrography coverage. The loop could look like the following:

    DIR_LOOP_START DIRECTORY="C:\PATH TO FILES" FILENAME_MASKS="DHT"

    IMPORT FILENAME="%FNAME_W_DIR%" TYPE="VPF" LOAD_FLAGS="COVERAGES=''HYDROGRAPHY''"

    DIR_LOOP_END

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • agenteh2o
    agenteh2o Global Mapper User
    edited March 2011
    Hi Mike,

    Thanks for getting back to me... I am still having problems, probably stemming from being a newbie and my lack of scripting experience. Here is the script I used:

    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    UNLOAD_ALL
    DIR_LOOP_START DIRECTORY="G:\MAPS\DNCs\" FILENAME_MASKS="DHT" RECURSE_DIR=YES
    IMPORT FILENAME="%FNAME_W_DIR%" TYPE="VPF" LOAD_FLAGS="COVERAGES=''HYDROGRAPHY''"
    DIR_LOOP_END

    However, when it runs it seems to work. I whirs away and seems to load the data but when it is finished it does not display the data. Do I need to add another command to complete that part? I want to be able to manipulate the data in the main GM window after the script completes.
  • agenteh2o
    agenteh2o Global Mapper User
    edited March 2011
    OK I figured out a solution... I just added the line:

    EXPORT_PACKAGE FILENAME="G:\MAPS\DNCs\Hydrography.gmp"

    to the end and then I can load that package after the script has completed.
  • agenteh2o
    agenteh2o Global Mapper User
    edited May 2011
    Hi again,
    I am trying to do the same type of thing with VMAP1 VPF data but I am having issues. I would like to open the "Boundaries" coverages for a bunch of VMAP1 datasets using the above method but I get an error that neither "Coverages" or "Boundaries" are not recognized. When I load some of the data manually and save the workspaces I see the following in the .GMW file:

    IMPORT FILENAME="S:\VMAP1\003_1\NOAMER\DHT" TYPE="VPF" LABEL_FIELD="" LOAD_FLAGS="lib_003?4?,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,F"
    IMPORT FILENAME="S:\VMAP1\005A_3\EURNASIA\dht" TYPE="VPF" LABEL_FIELD="" LOAD_FLAGS="lib_005a?4?,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
    IMPORT FILENAME="S:\VMAP1\024B_1\EURNASIA\DHT" TYPE="VPF" LABEL_FIELD="" LOAD_FLAGS="lib_024b?8?,,,,,,,1"

    ... there does not seem to be a consistent way to load the "Boundaries" portions via a script. Any ideas how to script this?
  • global_mapper
    global_mapper Administrator
    edited May 2011
    You can replace the cryptic LOAD_FLAGS with something like LOAD_FLAGS="COVERAGES=''Boundaries''" (to just load the boundaries layer. Note that you use 2 single quote marks (') to get quotes within quoted LOAD_FLAGS field. See the description below (from the SDK) for more information on the recognized values:

    You 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".

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • agenteh2o
    agenteh2o Global Mapper User
    edited May 2011
    Thanks Mike. I did not notice the single quotes when I did this technique the second time because the first time I copied and pasted and the second I typed it all out. Doh! Your suggestions are all working out well. Cheers.