POLYGON_CROP_USE_EACH — to separate folders?

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.
I'd like to be able to specify this variation instead.
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.]
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" \
...
...
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" \
...
...
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
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.)
Thanks,
Mike
Global Mapper Support
support@globalmapper.com
We're in a perfect position to give it a hammering today, so I'll let you know how it turns out.