Global Mapper v25.0

Batch clip rasters with single polygon shapefile

vagtazohalottkem
vagtazohalottkem Global Mapper UserTrusted User
edited December 2011 in Raster Data
Hi!

I read some article here, but i don't find the answer for my question:
I have 1000+ map sections, all georeferenced. I generated a grid, converted it to polygon and i want to cut the unusable part of the map sections. All map section have collar, with scale text, graticule, other informations. I don't need that, i want to clip all rasters with single polygon, if possible, without scripting.
I've tested the save raster menu option, but it clipped the outer parts of the sections, don't clipped the overlapping collars.

Any option in the Global Mapper 13 to perform this action?

Holla
P.

Comments

  • global_mapper
    global_mapper Administrator
    edited November 2011
    You can do what you want using scripting, but not directly in the interface, at least if I understand you correctly. You would basically have a simple script with a DIR_LOOP_START and DIR_LOOP_END command for looping through your files, then you would have inside that loop an IMPORT command to import the map section file, then an EXPORT_RASTER command to export to a new file, then finally an UNLOAD_ALL command to unload the loaded file. That EXPORT_RASTER script command would have a POLYGON_CROP_FILE parameter to specify the filename of the file with the grid polygons that specify how to crop each file. That parameter will cause the export to be cropped such that each output will use the polygon from the POLYGON_CROP_FILE that has the largest intersection with the loaded file, which should be the one that you want.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    gmsupport@bluemarblegeo.com
  • global_mapper
    global_mapper Administrator
    edited November 2011
    You can do what you want using scripting, but not directly in the interface, at least if I understand you correctly. You would basically have a simple script with a DIR_LOOP_START and DIR_LOOP_END command for looping through your files, then you would have inside that loop an IMPORT command to import the map section file, then an EXPORT_RASTER command to export to a new file, then finally an UNLOAD_ALL command to unload the loaded file. That EXPORT_RASTER script command would have a POLYGON_CROP_FILE parameter to specify the filename of the file with the grid polygons that specify how to crop each file. That parameter will cause the export to be cropped such that each output will use the polygon from the POLYGON_CROP_FILE that has the largest intersection with the loaded file, which should be the one that you want.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    gmsupport@bluemarblegeo.com
  • vagtazohalottkem
    vagtazohalottkem Global Mapper User Trusted User
    edited November 2011
    Holla Mike!

    First i thought that scripting is a baaad thing. Now i read the script from this:

    http://www.globalmapperforum.com/forums/raster-data/6357-clipping-multiple-overlapping-rasters-shapefile-index.html

    and i think it's kool. Someone said, i need arcgis 10 instead 9.3.1 to clip and mosaic alll my maps. (The Gis 10 supports more raster operations, clipping, footprints etc,). I think your program much more better than Arcgis in this case. (I think in some operations the globalmapper the simplest solution like open many maps and save to ONE big file, custom projection, etc.)

    That was the gratulation, and now i want to ask ya some questions:

    -my maps are in a projection, named hungarian hd 1972. This is a projected coordinate system. If i want to change the output projection to hd72, how can i make it? Global mapper supports the hd72, but i don't find any prj file in the intall dir.

    that was your sample:
    PROJ_FILENAME="Y:\ESRGC\Projects_inprocess\marylan d\cbca_dnr\StMarys\GM_Script\ProjectionFile\NAD83. prj"

    What i need to write instead nad83.prj if i want to use hd72?

    - Once, in an other project, i wanted to change projection of a shapefile in global mapper, wanted to browse for a downloaded prj file, but the global mappar didn't recognized the spotted prj file. (that projection wasn't the hd72, because it is supported by global mapper.) The prj files are from here:
    http://spatialreference.org/ref/sr-org/6778/

    Olla
    P
  • global_mapper
    global_mapper Administrator
    edited November 2011
    I'm glad that you have discovered the simplicity and power of scripting! To get a PRJ file, just setup the projection you want on the Projection tab of the Configuration dialog, then use the 'Save to File' button to save that to a PRJ file that you can then reference in a script.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    gmsupport@bluemarblegeo.com
  • vagtazohalottkem
    vagtazohalottkem Global Mapper User Trusted User
    edited December 2011
    Hi Mike!

    I've worked on my map-mocaik' project. I've georeferenced around 1100 map section (i made a grid for georeferencing, so i only needed to define the four corners of the sections. The grid made by GM ver 13!)

    I've cut the unneeded map frames, and i made a script by your direction. My opinion, that the GIS is based on multiple programs, and GlobalMapper maybe one of the best for some actions. I advised to my friends, who working with GIS, to buy and use that software!

    Thanks for your help,
    Best regards!
    vagtazo