POLYGON_CROP_USE_EACH — to separate folders?

tjhbtjhb Global Mapper UserPosts: 454Trusted User
edited March 2011 in Suggestion Box
In scripting GM, we can currently use a set of areas to crop vector output into a set of tiles (or other shapes), each crop identified in its filename by a suffix (which is driven either by the name of an attribute in the cropping areas, or according to an automated scheme).

I use this just about daily and I really like the way it works.

A great addition would be the capacity to export each resulting crop to a different subfolder, which would be given the name currently used for the filename suffix.

E.g. I can currently specify this.
EXPORT_VECTOR FILENAME="E:\Output.shp" \
...
POLYGON_CROP_FILE="D:\AOI\Grid.shp" \
POLYGON_CROP_USE_EACH=YES \
POLYGON_CROP_NAME_ATTR="Label" \
...

I'd like to be able to specify this variation instead.
EXPORT_VECTOR FILENAME="E:\Output.shp" \
...
POLYGON_CROP_FILE="D:\AOI\Grid.shp" \
POLYGON_CROP_USE_EACH=YES \
POLYGON_CROP_FOLDER_ATTR="Label" \
...

So that instead of a filename suffix, distinct values in the "Label" column in Grid.shp would be used to sort output into subfolders of E:\Output\. If a folder with a given name already existed, it would be used; otherwise a new folder with that name would be created.

This would be especially useful for clipping a large number of vector files into a subsets for each AOI. We could loop over a set of source shapefiles in folder A and have the cropped output for each area collected in folder B, subfolder X.

[One wrinkle: we can currently specify a blank filename when using POLYGON_CROP_NAME_ATTR. In that case, EXPORT_VECTOR FILENAME="E:\.shp" will just use the ATTR value for each new filename in E:\. A blank filename wouldn't make sense for something like POLYGON_CROP_FOLDER_ATTR—an explicit filename would probably be required.]

Comments

  • tjhbtjhb Global Mapper User Posts: 454Trusted User
    edited March 2011
    (This would be similar to the functionality of GRID_CREATE_FOLDERS, but for custom gridding/segmentation rather than rule-based gridding. So an alternative way of specifying it would be POLYGON_CROP_CREATE_FOLDERS.

    It would be really really nice if in the long run the "same" functionality could be extended also to SPLIT_BY_ATTR, so that the "split" for each distinct attribute went into its own subfolder of the target folder. Perhaps SPLIT_BY_ATTR_CREATE_FOLDERS could govern this. Eventually.)
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited March 2011
    I have added support for a POLYGON_CROP_FOLDER_ATTR parameter to add a folder to the output filename. I have placed a new build at http://www.globalmapper.com/global_mapper12.zip with the change for you to try. Simply download that file and extract the contents into your existing v12.xx installation folder to give it a try. If you are using the 64-bit v12 version there is a new build at http://www.globalmapper.com/global_mapper12_64bit.zip . Only very minimal testing has been done, so let me know if any problems crop up and I can test further.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • tjhbtjhb Global Mapper User Posts: 454Trusted User
    edited March 2011
    I'm extremely grateful thank you Mike. Yet another new feature that will save us hours, over and over.

    We're in a perfect position to give it a hammering today, so I'll let you know how it turns out.
Sign In or Register to comment.