Grid Polygons

CO_CraigCO_Craig Global Mapper UserPosts: 8
edited February 2012 in Raster Data
I am working on a script to batch clip 4-band raster imagery based on a polygon. I can not find a command to grid the polygons so it will clip everything outside of the polygon, so I was wondering what command I would use and where to put it in the script. I am using v11. Here is my current script:
GLOBAL_MAPPER_SCRIPT VERSION=1.00
DIR_LOOP_START DIRECTORY="[URL="file://\\PH88NS80G1\V3$\PH\Projects\71876_YellowstoneRiver_2011\PRS\Ortho\OVSheets\ready_for_QC\gimped\craig_test"]folder_path[/URL]" FILENAME_MASKS="*.TIF" RECURSE_DIR=NO
IMPORT FILENAME="%FNAME_W_DIR%" TYPE="GEOTIFF" LOAD_FLAGS="0~0~0~4~0~1"

PROJ_FILENAME="[URL="file://\\PH88NS80G1\V3$\PH\Projects\71876_YellowstoneRiver_2011\PRS\Ortho\OVSheets\ready_for_QC\gimped\craig_test\Montana.prj"]projectio[/URL]n"

EXPORT_RASTER FILENAME="%DIR%%FNAME_WO_EXT%_CLIP.TIF" TYPE="GEOTIFF"

SPATIAL_RES="1.0000000000000,1.00000000000000" PALETTE=MULTIBAND NUM_BANDS=4 FORCE_SQUARE_PIXELS=YES GEN_WORLD_FILE=YES

POLYGON_CROP_FILE="[URL="file://\\PH88NS80G1\V3$\PH\Projects\71876_YellowstoneRiver_2011\PRS\Ortho\OVSheets\ready_for_QC\gimped\craig_test\boundary.shp"UNLOAD_ALLDIR_LOOP_END"]boundary.shp"
UNLOAD_ALL
DIR_LOOP_END
[/URL]

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited February 2012
    The POLYGON_CROP_FILE parameter that you have goes with the EXPORT_RASTER script command. Just include it as a parameter for that command and then the specified file will be used to crop the export. By default if the file has multiple polygons in it then the largest intersecting polygon will be used for the crop, but there are other options to change that behavior.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • CO_CraigCO_Craig Global Mapper User Posts: 8
    edited February 2012
    Is there a way to control the color that global mapper will use to clip the raster? I was wondering if I could get it to clip everything outside the polygon to white.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited February 2012
    Yes, everything outside the polygon will be filled with the current background color, which you can set with SET_BG_COLOR.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • CO_CraigCO_Craig Global Mapper User Posts: 8
    edited February 2012
    I included the SET_BG_COLOR command to 255 but the clipped area still comes out black. I am wondering if there is still something in the script that I am missing or the syntax is wrong or is somehow the polygon is affecting the clipping process. Here is my current script:

    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    SET_BG_COLOR COLOR=RGB(255,255,255)

    DIR_LOOP_START DIRECTORY="C:\Users\lundgren\Desktop\CLIP" FILENAME_MASKS="*.TIF" RECURSE_DIR=NO

    LOAD_PROJECTION FILENAME="C:\Users\lundgren\Desktop\CLIP\Montana.prj"

    IMPORT FILENAME="%FNAME_W_DIR%" TYPE="GEOTIFF" LOAD_FLAGS="0~0~0~4~0~1"

    EXPORT_RASTER FILENAME="%DIR%%FNAME_WO_EXT%_CLIP.TIF" TYPE="GEOTIFF" BG_TRANSPARENT=YES SPATIAL_RES="1.0000000000000,1.00000000000000" PALETTE=MULTIBAND NUM_BANDS=4 FORCE_SQUARE_PIXELS=YES GEN_WORLD_FILE=YES POLYGON_CROP_FILE="C:\Users\lundgren\Desktop\CLIP\clip_bound.shp"

    UNLOAD_ALL

    DIR_LOOP_END
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited February 2012
    What version of Global Mapper are you using? For multi-band exports the background color didn't used to matter since it only covered 3 bands, but recently we made a change so that if your background color is grayscale (like white), then that grayscale value (255 in this case) would be used for any no data (background) areas. I have placed a new build at http://www.globalmapper.com/global_mapper13.zip with the change for you to try. Simply download that file and extract the contents into your existing v13.xx installation folder to give it a try. If you are using the 64-bit v13 version there is a new build at http://www.globalmapper.com/global_mapper13_64bit.zip .

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • CO_CraigCO_Craig Global Mapper User Posts: 8
    edited February 2012
    I am using version 11. I tried downloading a trial version of v13 but the script wouldnt run unless I register.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited February 2012
    You would have to upgrade to v13 to get the new behavior. You can contact gmorders@bluemarblegeo.com about upgrading from v11 to v13 at a discounted price.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
Sign In or Register to comment.