Script command equivalent to "Crop Right and Bottom Cells to Export Bounds"

Hello,

I'm writing a script to export rasters but I don't find the script command equivalent to the option button "Crop Right and Bottom Cells to Export Bounds" of the "Tiling" tab; if I set GRID_TYPE_PIXEL_SIZE, the rasters have the desired pixel size but the right and bottom cells of the export include the Global Mapper background; if I set GRID_TYPE_PIXEL_SIZE_MAX, the rasters don't have the desired pixel size but the right and bottom cells of the export don't include the Global Mapper background. I would like to have the specified pixel size to all the raster but the right and bottom cells. Do you have any solution?


Thank you.


Tagged:

Answers

  • // Global Mapper Script: Export_Imagery
    //*****************************************************************************
    //Script to generate the imagery
    //*****************************************************************************

    //Standard declaration
    GLOBAL_MAPPER_SCRIPT VERSION=1.00 ENABLE_PROGRESS=YES SHOW_WARNINGS=YES

    //Declaration of the variables
    DEFINE_VAR NAME="PROJECTION" VALUE="C:\Source\Projection.prj"

    DEFINE_VAR NAME="INPUT_PATH_IMAGERY" VALUE="C:\Source\"
    DEFINE_VAR NAME="INPUT_PATH_VECTOR" VALUE="C:\Source\"
    DEFINE_VAR NAME="INPUT_FILENAME_IMAGERY" VALUE="Raster"
    DEFINE_VAR NAME="INPUT_FILENAME_VECTOR" VALUE="Vector"

    DEFINE_VAR NAME="OUTPUT_PATH" VALUE="C:\Export\"
    DEFINE_VAR NAME="OUTPUT_FILENAME" VALUE="Raster"

    DEFINE_VAR NAME="LOG_PATH" VALUE="C:\Export\"
    DEFINE_VAR NAME="LOG_FILENAME" VALUE="Log.txt"

    //Set of the log file path
    SET_LOG_FILE FILENAME="%LOG_PATH%%LOG_FILENAME%"

    //Unload of the data
    UNLOAD_ALL VECTOR_ONLY=NO

    //Load of the projection
    LOAD_PROJECTION PROJ=%PROJECTION%

    //Import of the raster
    IMPORT FILENAME="%INPUT_PATH_IMAGERY%%INPUT_FILENAME_IMAGERY%.gmc" TYPE="GLOBAL_MAPPER_CATALOG" HIDDEN="NO" LABEL_FIELD_FORCE_OVERWRITE="NO" ZOOM_DISPLAY="PERCENT,0.10000000,0.0000000000" \
         LIDAR_DRAW_MODE_GLOBAL="YES" LIDAR_DRAW_MODE="ELEV" LIDAR_POINT_SIZE="0" LIDAR_DRAW_QUALITY="50" \
         CLIP_COLLAR="NONE" SAMPLING_METHOD="NEAREST_NEIGHBOR" AUTO_CONTRAST="NO" CONTRAST_SHARED="YES" CONTRAST_MODE="NONE" TEXTURE_MAP="NO" IGNORE_ALPHA="YES"

    //Import of the vector
    IMPORT TYPE=SHAPEFILE FILENAME="%INPUT_PATH_VECTOR%%INPUT_FILENAME_VECTOR%.shp"

    //Export of the raster
    EXPORT_RASTER EXPORT_LAYER="%INPUT_PATH_IMAGERY%%INPUT_FILENAME_IMAGERY%.gmc" FILENAME="%OUTPUT_PATH%%OUTPUT_FILENAME%.tif" OVERWRITE_EXISTING=YES \

         TYPE=GEOTIFF \

         PALETTE=MULTIBAND \
         NUM_BANDS=3 \
         BAND_BIT_DEPTH=8 \
         BAND_EXPORT_SETUP="1?1?" \
         BAND_EXPORT_SETUP="2?2?" \
         BAND_EXPORT_SETUP="3?3?" \
         SAMPLING_METHOD=NEAREST_NEIGHBOR \
         SPATIAL_RES_METERS="30.000,30.000" \
         FORCE_SQUARE_PIXELS=YES \
         EXPORT_SCALE=0 \

         BG_TRANSPARENT=NO \
         INC_VECTOR_DATA=NO \
         FILL_GAPS=NO \
         ONLY_GENERATE_METADATA=NO \

         GEN_WORLD_FILE=YES \
         GEN_PRJ_FILE=YES \
         GEN_TAB_FILE=NO \
         GEN_AUX_XML_FILE=NO \
         GEN_OZI_MAP_FILE=NO \
         GEN_ERS_FILE=NO \

         COMPRESSION=LZW \
         QUALITY=75 \
         DISABLE_BIGTIFF=NO \
         TIFF_NO_GTIFF_HEADER=NO \

         GRID_TYPE_PIXEL_SIZE="1024,1024" \
         GRID_OVERLAP=0 \
         GRID_OVERLAP_NUM_PIXELS=YES \
         GRID_NAMING=SEQUENTIAL \
         GRID_NAMING_COLS=NUM \
         GRID_NAMING_ROWS=ALPHA \
         GRID_NAMING_PREPEND_ZEROES=YES \
         GRID_NAMING_SEPARATOR="_" \
         GRID_CREATE_FOLDERS=NO \

         POLYGON_CROP_FILE=%INPUT_FILENAME_VECTOR%.shp \
         POLYGON_CROP_FILE_PROJ=%PROJECTION% \
         POLYGON_CROP_USE_ALL=NO \
         POLYGON_CROP_USE_EACH=NO \
         POLYGON_CROP_EXCLUDE=NO \
         POLYGON_CROP_BBOX_ONLY=NO \
         POLYGON_CROP_GRID_ONLY=NO \
         POLYGON_CROP_INT_DATA_BOUNDS=YES \
         POLYGON_CROP_NAME_ATTR="" \
         POLYGON_CROP_FOLDER_ATTR="" \
         POLYGON_CROP_FILENAME_SUFFIX="___" \
         POLYGON_CROP_COMPARE_STR="NAME=Bounds"

    //Unload of the data
    UNLOAD_ALL VECTOR_ONLY=NO


  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,146
    Hello,

    Try using GRID_FILL_TO_BOUNDS=YES. It appears that this was inadvertently left out of the documentation.

    Cheers,
    Bob
  • Hello,

    I insert the command GRID_FILL_TO_BOUNDS=YES to the script but the export still include the background; I also add the instructions LAYER_BOUNDS="%INPUT_PATH_IMAGERY%%INPUT_FILENAME_IMAGERY%.gmc" and USE_EXACT_BOUNDS=YES but the result is always the same.


    Thank you.
Sign In or Register to comment.