I've created a map in qgis 2.0. The map uses the OpenLayers plug-in to add the OSM layer as a basemap. I would like to restrict the basemap to be visible only inside a given polygon defined in a shapefile layer. How do I achieve this?
This way it works for me:
Create a worldwide polygon shapefile stretching from +180°E to -179,99°E and from +85.5°N to -85.5°N with a text file containing
1;POLYGON ((180 85.5, -179.9 85.5, -179.99 -85.5, 180 -85.5, 180 85.5))
Add that file as
Text delimited layer, using semicolon as separator and WGS84 as CRS.
Save the layer as shapefile in the CRS of your polygon, add that to the canvas and delete the text file layer.
Subtract your polygon shapefile from that, and set the fill of the remaining polygon to 100% white.
Put it on top the Openlayers layer, and only the wanted area will be visible for all zoom levels: