clip based on extent of other dataset(s)
|Assigned to:||Tim Sutton||% Done:||
|Category:||Python plugins and bindings|
|Target version:||Version 2.0.0|
|Platform version:||Patch supplied:||No|
A task I frequently need to do, and judging from the increasing frequency of messages of a similar vein on the gdal and fwtools mailing lists so do many others, is cut up a dataset based on the extent of another. More often raster than vector, but vector too. A similar oft-repeated question is how to take a humungous image and chop it into smaller more manageable tiles. Both of these I think could be handled by the same mechanism.
I'm proposing this for qgis rather than gdal as I think this is better suited to an interactivity (select polys x,y,z, then clip) more often than not. Of course exporting to script is desired too! In my head it looks like this:
- query extent of Object A, where A can be either a whole dataset, a sub-selection thereof (e.g. a polygon), or a super-selection (all of these layers together)
- clip Object B
- if a A is multi-part (many polygons, or perhaps a raster catalog) then create many tiles.
It might look something like: clip [options] [dest] [source]
source = any raster or vector, or sub/super selection thereof (which is why source is at the end of the list)
dest = single file (clipped.tif) or directory (d:\tiles\)
--padding N% or Npx or Nmap-units. Expands spatial extent by specified amount, defaults to 10%. Negative number to shrink extent. None or 0 (zero) mean exact match.
--multi [yes, no] should whole data extent be used or are we making tiles? Defaults to no.
--name-on [attribute] base output filename(s) on specified attribute's value. Probably only makes sense in a tiling operation.
--create-index also create a gdaltindex style index of the output.
--pass-thru "..." options to hand off to the backend, e.g. "-co compress=lzw", "--outsize 50% 50%" etc. not sure if this one is a good idea
Updated by Tim Sutton over 5 years ago
- Status changed from New to In Progress
Changed to minor since this is not functionality that we currently have and is broken, but rather a feature request. I'm also changing to 2.0.0 milestone since we wont have time to do it pre 1.0.0 release. Nice idea though and I am sure we will implement it in the future.
Updated by Bill Williamson over 2 years ago
Updated by Giovanni Manghi almost 2 years ago
- Status changed from In Progress to Feedback
- Patch supplied set to No
What this would add to the clipping tools we have for both rasters and vectors?
To create tiles we have two options, that can be added to the gdaltools (raster) menu:
- add the gdal2tiles tool
- in the clipper menu, when using a vector mask, add the possibility to run the tool in batch mode by selecting a folder of vector masks to be used to clip one single raster input map
I will add both feature request tickets, and this should be close. Please leave feedback.