2

I have two layers, one which contains a polygon, and one which contains contours. Unfortunately, they have different projections.

I want to label the contours with their elevations BUT I only want the labels to be displayed within the bounds of the polygon (a site buffer), rather than all over the map.

Is it possible to do so? Will I have to make both layers the same projection, and clip the contour layer?

I've read through some of the other related answers here, but none seem to be right for what I am trying to do.

  • It would be productive to transform your both layers into uniform projection. You may use v.proj tool available within QGIS to do so. Thereafter, you should be able to get desire results. – Ben Nov 1 '18 at 8:46
1

I have not tested this with layers in two different projections, as Ben says in the comments above it is almost always best to work with data in the same projection.

One method that does work is to use the "Mask" plugin.

  1. Select your site boundary polygon
  2. Open the mask plugin
  3. The formatting of the mask doesn't matter because you're not actually going to use it (you could set it to transparent). Instead play with the label limiting functions (figure below) - a quick experiment suggests that "Exact" filtering and "The mask geometry contains the line" limits labelling of contours to within a polygon. Anything else you get some outliers.

Mask Plugin UI

  1. Click OK and the mask is added to the TOC and the label limiting is applied to the contour layer. You can turn off the mask, but don't remove it from the TOC.

Mask Result

This method is less likely to work with flatter terrain in which contours aren't contained within the site boundary, or with very complex contours or site boundary (it will take a long time and be unstable). In both those cases I would look to clip the contour data instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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