Global Mapper Pro Coming Soon

CROP by 1% of original data

selebetsselebets Global Mapper UserPosts: 25Trusted User
edited January 2015 in Elevation Data
Sir,

How to do batch cropping for multi tiles of elevation grid in geotif files. I want to crop my data by 1% of the original data. Or can we specify by 5 or 10 pixel... i have more than 1000 tiles to work for. Thanks in advance

Happy new year!!!

Comments

  • Ice Age MarkIce Age Mark Global Mapper User Posts: 324Trusted User
    edited December 2014
    I've used this script to crop whole folders of large High Resolution Orthoimagery files that overlapped substantially. You might be able to adjust it to accomplish your task by script. It just creates a bounding polygon, scales that, then crops to it, and exports. One drawback is that if the files are a mosaic, the perimeter is reduced by the scale amount too. I added a "c" to the export filename to distinguish the cropped files from the originals. I'm sure anyone with less primitive programming skills than I have could fix this up nicely for various tasks.




    GLOBAL_MAPPER_SCRIPT VERSION="1.00" FILENAME="[IMAGE CROP].gms"
    SET_BG_COLOR COLOR="RGB(0,0,0)"


    DEFINE_VAR NAME="DIRECTORY" VALUE="" \
    PROMPT="DIR" PROMPT_TEXT="CHOOSE DIRECTORY OF IMAGES TO CROP"


    DEFINE_VAR NAME="MASK" VALUE="" \
    PROMPT="YES" PROMPT_TEXT="FILENAME MASK (blank for all files)"


    DEFINE_VAR NAME="SCALEX" VALUE="" \
    PROMPT="YES" PROMPT_TEXT="ENTER X SCALE FACTOR"


    DEFINE_VAR NAME="SCALEY" VALUE="" \
    PROMPT="YES" PROMPT_TEXT="ENTER Y SCALE FACTOR"


    DIR_LOOP_START DIRECTORY="%DIRECTORY%\" FILENAME_MASKS="%MASK%"
    IMPORT FILENAME="%FNAME_W_DIR%"
    GENERATE_LAYER_BOUNDS BOUNDS_TYPE=POLYGON
    EDIT_VECTOR FILENAME="Layer Bounds" COORD_SCALE=%SCALEX%,%SCALEY%
    EXPORT_RASTER FILENAME="%DIRECTORY%\%FNAME_WO_EXT%c.tif" TYPE="GEOTIFF" LABEL_FIELD_FORCE_OVERWRITE="NO" HIDDEN="NO" SAMPLING_METHOD="NEAREST_NEIGHBOR" \
    AUTO_CONTRAST="NO" CONTRAST_SHARED="NO" CONTRAST_MODE="NONE" CLIP_COLLAR="NONE" INC_VECTOR_DATA="NO" POLYGON_CROP_FILE="LAYER BOUNDS"
    UNLOAD_ALL
    DIR_LOOP_END




    Mark
  • selebetsselebets Global Mapper User Posts: 25Trusted User
    edited January 2015
    Thanks Mark.. I will try it. Need understand the flow first...
Sign In or Register to comment.