3

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!

2

1 Answer 1

5

In QGIS, use the Clipper raster tool, under the Raster-> Extraction menu. See: Clipping raster with vector boundaries using QGIS?

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 KyngChaos.com frameworks, then gdal and its utility programs are located in:

/Library/Frameworks/GDAL.framework/Versions/1.9/Programs

Read the README included with the KyngChaos.com 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

2
  • 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
    Commented Jun 5, 2012 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
    Commented Jun 5, 2012 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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