Global Mapper v25.0

Export_Raster script first image export takes longer depending on the number of rasters in the layer

When using Export_Raster to make some different deliverable formats, the script takes longer to output the FIRST image depending on how many rasters are in the script. The rest seem to go at normal speed after the first one is done. 

I am loading RGBN Geotiffs and exporting RGB Geotiffs, CIR Geotiffs, RGBN .JP2, RGB .JP2, and CIR .JP2.

I am importing all the files and using Layer_Loop to export each format of raster (5 different formats mentioned above) for image 1 through 69. The first image estimates at about 5 hours to export

When running the script with 5 images, the first image exports in 5 min, when running with 12, the first image exports in about 24 minutes; 10 images, first export 20 min. This was all the test cases I used before contacting support. 

I am running Global Mapper 18 (b062017), windows 8.1

Answers

  • So I tried the export with the full data set of 69 images and it crashed out with an exception.

    It only wrote the first image, which seems to include the data from the first image in the layer group plus a bunch extra. It looks like GM wrote white pixels for the full area out to the extents of all the images and then the proper data where the first image is located.

    For now we'll have to run 10 or so images at a time, which seems to work. 

    In the meantime, I also tried this on a different machine running Windows 7, and GM 18.2 and ran into the same problems.


  • Here is a copy of the script:

    // Define Name
    DEFINE_VAR NAME="GROUP_NAME" PROMPT=YES ABORT_ON_CANCEL=YES PROMPT_TEXT="Enter Name"
    // Define Root Folder of Project Export
    DEFINE_VAR NAME="DATA_DIR" PROMPT=DIR ABORT_ON_CANCEL=YES PROMPT_TEXT="Point Root Directory"
    // Define Project Projection
    DEFINE_VAR NAME="EPSG" PROMPT=YES ABORT_ON_CANCEL=YES PROMPT_TEXT="Enter EPSG Code of Projection"

    // ************************************** JPEG2000 and RGBN CIR Export ****************************************

    DEFINE_VAR NAME="GEOTIFF_DIR" VALUE="%DATA_DIR%Export\TIFF_Imagery\"
    DEFINE_VAR NAME="JPEG2000_DIR" VALUE="%DATA_DIR%Export\JP2_Imagery\"

    LOG_MESSAGE <%TIME%> Start Importing Images

    IMPORT_DIR_TREE DIRECTORY="%GEOTIFF_DIR%RGBN\" \
    TYPE="GEOTIFF" LABEL_FIELD_FORCE_OVERWRITE="NO" CLIP_COLLAR="NONE" SAMPLING_METHOD="NEAREST_NEIGHBOR" \
    AUTO_CONTRAST="NO" CONTRAST_SHARED="YES" CONTRAST_MODE="NONE" TEXTURE_MAP="NO" LAYER_DESC="RGBN_IMAGES" \
    LAYER_GROUP="RGBN Images" LOAD_FLAGS="0~0~0~4~0~0" PROJ="EPSG:%EPSG%" FILENAME_MASKS="*.TIF *.TIFF"

    LAYER_LOOP_START FILENAME="RGBN_IMAGES"
    DEFINE_VAR NAME="CURRENT_IMAGE" VALUE = "%LAYER_FNAME%"
    DEFINE_VAR NAME="CURRENT_IMAGE_W_DIR" VALUE = "%LAYER_FNAME_W_DIR%"
    DEFINE_VAR NAME="CURRENT_IMAGE_WO_EXT" VALUE = "%LAYER_FNAME_WO_EXT%"
    EXPORT_RASTER FILENAME="%GEOTIFF_DIR%RGB\%CURRENT_IMAGE_WO_EXT%_RGB.TIF" TYPE="GEOTIFF" COMPRESSION="LZW"\
    NUM_BANDS=3 PALETTE="MULTIBAND" BAND_BIT_DEPTH=8 PROJ="EPSG:%EPSG%" GEN_PRJ_FILE=YES GEN_WORLD_FILE=YES \
    BAND_EXPORT_SETUP="1?1?%CURRENT_IMAGE_W_DIR%" \
            BAND_EXPORT_SETUP="2?2?%CURRENT_IMAGE_W_DIR%" \
            BAND_EXPORT_SETUP="3?3?%CURRENT_IMAGE_W_DIR%" 

    EXPORT_RASTER FILENAME="%GEOTIFF_DIR%CIR\%CURRENT_IMAGE_WO_EXT%_CIR.TIF" TYPE="GEOTIFF" COMPRESSION="LZW"\
    NUM_BANDS=3 PALETTE="MULTIBAND" BAND_BIT_DEPTH=8 PROJ="EPSG:%EPSG%" GEN_PRJ_FILE=YES GEN_WORLD_FILE=YES\
    BAND_EXPORT_SETUP="1?4?%CURRENT_IMAGE_W_DIR%" \
            BAND_EXPORT_SETUP="2?1?%CURRENT_IMAGE_W_DIR%" \
            BAND_EXPORT_SETUP="3?2?%CURRENT_IMAGE_W_DIR%" 

    EXPORT_RASTER FILENAME="%JPEG2000_DIR%RGBN\%CURRENT_IMAGE_WO_EXT%_RGBN.JP2" TYPE="JPEG2000" \
    NUM_BANDS=4 PALETTE="MULTIBAND" BAND_BIT_DEPTH=8 PROJ="EPSG:%EPSG%" GEN_PRJ_FILE=YES GEN_WORLD_FILE=YES\
    BAND_EXPORT_SETUP="1?1?%CURRENT_IMAGE_W_DIR%" \
            BAND_EXPORT_SETUP="2?2?%CURRENT_IMAGE_W_DIR%" \
            BAND_EXPORT_SETUP="3?3?%CURRENT_IMAGE_W_DIR%" \
    BAND_EXPORT_SETUP="4?4?%CURRENT_IMAGE_W_DIR%" 
    EXPORT_RASTER FILENAME="%JPEG2000_DIR%RGB\%CURRENT_IMAGE_WO_EXT%_RGB.JP2" TYPE="JPEG2000" \
    NUM_BANDS=3 PALETTE="MULTIBAND" BAND_BIT_DEPTH=8 PROJ="EPSG:%EPSG%" GEN_PRJ_FILE=YES GEN_WORLD_FILE=YES\
    BAND_EXPORT_SETUP="1?1?%CURRENT_IMAGE_W_DIR%" \
            BAND_EXPORT_SETUP="2?2?%CURRENT_IMAGE_W_DIR%" \
            BAND_EXPORT_SETUP="3?3?%CURRENT_IMAGE_W_DIR%" 
    EXPORT_RASTER FILENAME="%JPEG2000_DIR%CIR\%CURRENT_IMAGE_WO_EXT%_CIR.JP2" TYPE="JPEG2000" \
    NUM_BANDS=3 PALETTE="MULTIBAND" BAND_BIT_DEPTH=8 PROJ="EPSG:%EPSG%" GEN_PRJ_FILE=YES GEN_WORLD_FILE=YES\
    BAND_EXPORT_SETUP="1?4?%CURRENT_IMAGE_W_DIR%" \
            BAND_EXPORT_SETUP="2?1?%CURRENT_IMAGE_W_DIR%" \
            BAND_EXPORT_SETUP="3?2?%CURRENT_IMAGE_W_DIR%" 
    LAYER_LOOP_END
    UNLOAD_ALL
  • So it seems like every image has the bounding box of the entire set of images.

    I solved the problem by using DIR_LOOP instead of Layer_Loop and closing each layer before opening the next one.