Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given a shapefile composed of contiguous polygons, I'd like to clip (or mask) regions of satellite photo to the polygon outlines, and export each resulting raster in medium resolution for further processing.

I've gotten as far as overlaying the shapefile on Google Maps imagery (in QGIS, with Openlayers plugin), but I can't find any operation to intersect vector data with raster data (presuming that the Openlayers layer is indeed treated as a raster layer).

A simple solution would be great, and suggestions of other free OSX-compatible software are fine. A programmatic solution would be ideal (though not requisite) as I'd like to export many such images, each named by an attribute field in the shapefile.

I hope I haven't over-explained a simple problem, but alas, I'm rather new to GIS software. Trying to move forward with this project as quickly as possible, but stymied by data acquisition... Thanks a ton!

share|improve this question
Do any of these related threads answer your question?,, – whuber Jun 5 '12 at 0:54
These provide useful additional context to dakcarto's perfectly neophyte-pitched answer. Thank you. – sunspeck Jun 5 '12 at 7:30
up vote 5 down vote accepted

In QGIS, use the Clipper raster tool, under the Raster-> Extraction menu. See: How to clip a raster with vector boundaries?

enter image description here

You may have issues trying to clip data in a plugin layer (e.g. Openlayers) because the Clipper function requires a input graphic file (raster) from disk. Your best bet is to get the satellite imagery directly from the source and load that into QGIS.

Check here for most from Landsat missions:
USGS Global Visualization Viewer

Once you get it working in QGIS, delve into the gdalwarp utility (see code generated at bottom of Clipper dialog) to see about scripting your clippings (via bash or Python).

If you have installed QGIS using the frameworks, then gdal and its utility programs are located in:


Read the README included with the installers to see about updating your bash (Terminal) PATH environment variable.

EDIT: In your scripting you will need to loop through the features of your shapefile (used here as a cutline) and spatially match it up to the appropriate imagery. Alternatively, if it is a one-off project, you can export features to separate shapefiles using the Split vector layer tool, located under the Vector-> Data Management Tools menu. It may make your life easier when learning to make your first batch scripts.

enter image description here

share|improve this answer
A superb answer, thank you so much. – sunspeck Jun 5 '12 at 7:10
And you're right: the Clipper tool unfortunately won't work with a Google Maps layer. I suppose it's due to licensing that you can't easily save georeferenced Google imagery. So I guess I'm back on the hunt for neighborhood-resolution satellite data, but from there it looks like gdalwarp and the Split vector layer tool will be just the ticket. – sunspeck Jun 5 '12 at 7:18
(And for other newbies: to access the Clipper and other raster tools, you'll have to enable the preinstalled GdalTools plugin under 'Manage Plugins') – sunspeck Jun 5 '12 at 7:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.