Global Mapper v25.0

Export warning on some rasters, but not all.

Hi,

I have written a script that imports a gmp file with several layers all containing polygons/areas, representing different islands.

The script then loops through a folder containing raster files (*.tif) and imports them. Each raster represents a town. The aim is to crop the water around the islands.

The script actually works perfectly with some raster and not with others. When it doesn't work, I get this warning message: "WARNING: No data found to export for EXPORT_RASTER command within specified bounds." The raster then isn't exported to the assigned folder.

There are both working and non-working rasters (towns) within the same polygon (island). The files are all in the same projection and datum. The metadata of the working and non-working rasters are identical. (I created both rasters the same way.)

I tried cropping the non-working raster manually in Global Mapper without any problems.

Any help or thoughts is much appreciated.

-Andreas

Ps. The script looks like this:

GLOBAL_MAPPER_SCRIPT VERSION="1.00"
SET_LOG_FILE FILENAME=crop_LOG.TXT

/******* Script Starts *********
DEFINE_VAR \
  NAME="variable_name" \
  VALUE="C:\folder\file.gmp"

IMPORT \
  FILENAME=%variable_name%

/*********** Loop Starts **********

DIR_LOOP_START \
  DIRECTORY="C:\folder\to\put\files\to\be\cropped"

IMPORT \
  FILENAME=%FNAME_W_DIR% \
  TYPE=AUTO \
  PROJ=5316

EXPORT_RASTER FILENAME="C:\folder\to\place\cropped\files\
  TYPE=GEOTIFF \
  PROJ=5316 \
  BG_TRANSPARENT=YES \
  COMPRESSION=LZW \
  POLYGON_CROP_FILE=%variable_name%

UNLOAD_LAYER \
  FILENAME=%FNAME_W_DIR%

DIR_LOOP_END
UNLOAD_ALL
Tagged:

Answers

  • Mykle
    Mykle Global Mapper User Trusted User
    Does your script include a closing " at the end of the EXPORT_RASTER FILENAME value?
    In your post, I see one at the beginning of that value, and not at the end.
  • Thanks for your answer.

    The " is there in the original script. I must have accidently erased it when copy/pasting it to the board.

    The strange thing is that it works on some files and not on others, eventhough the meta data is identical. I can also crop it manually in the software. But when running the script, the log file gives me the warning.