How do I clip OSM basemap with a polygon?

by Llaves   Last Updated September 11, 2019 13:22 PM - source

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?

Answers 2

This way it works for me:

  1. 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))

  2. Add that file as Text delimited layer, using semicolon as separator and WGS84 as CRS.

  3. Save the layer as shapefile in the CRS of your polygon, add that to the canvas and delete the text file layer.

  4. Subtract your polygon shapefile from that, and set the fill of the remaining polygon to 100% white.

  5. Put it on top the Openlayers layer, and only the wanted area will be visible for all zoom levels:

enter image description here

October 01, 2013 16:49 PM

i have tried doing this but i am stuck at the third step.I have created a text document an imported it as a polygon but i have no idea of how to go about the third step.

September 11, 2019 12:59 PM

Related Questions

OpenLayers coordinate system

Updated July 29, 2019 03:22 AM

Vector and OpenLayers rendering problem

Updated August 16, 2016 08:09 AM

Overlaying Google Map in standalone PyQgis application?

Updated November 28, 2017 02:22 AM