Feature request #480

clip based on extent of other dataset(s)

Added by maphew-gmail-com - almost 14 years ago. Updated over 8 years ago.

Assignee:Tim Sutton
Category:Python plugins
Pull Request or Patch supplied:No Resolution:invalid
Easy fix?:No Copied to github as #:10539


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


#1 Updated by Tim Sutton about 12 years ago

  • Status changed from Open 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.

#2 Updated by Paolo Cavallini over 11 years ago

Seems a good task for a python plugin.

#3 Updated by Bill Williamson over 9 years ago

This ticket is same as
#3066 GdalTools: clipping based on a shapefile mask - since the effort of TeamQGIS - I now say "works for me" in 1.7
as far as raster is concerned, but I have not used the vector / vector clipping tools.
So close?

#4 Updated by Giovanni Manghi almost 9 years ago

  • Status changed from In Progress to Feedback
  • Pull Request or 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.

#5 Updated by Giovanni Manghi over 8 years ago

  • Resolution set to invalid
  • Status changed from Feedback to Closed

See #4702 and # 4703

Closing for lack of feedback. Reopen if necessary.

Also available in: Atom PDF