Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is their a way within QGIS to prevent text labels from overlapping icons used to label a point layer?

In the example map shown below, there are two layers:

  1. Roads layer which is labeled using the new labeling engine.
  2. A point layer which uses svg icons to show highway shields.

I have other use cases for this such as preventing overlapping of rail station icons. In this example, I could simply move the point, however, in other cases, such as a subway station, that is not a workable solution.

A possible solution which I am considering would involve:

  1. Adding a column to the point layer's dbf file.
  2. Filling the added column with either Null or a space.
  3. Enabling QGIS's [new style] labeling for the added column.

Is this the way to go or is there a better method?

Sample Map

QGIS info: I am using versions 1.7.4 and a recently compiled version of 1.8 on Mac OS 10.7.4. Linux and Windows versions are also available to me.


Progress Update: The method I described above works though two modifications to the process are required.

  1. Instead of using a space character or a Null, a non-breaking space has to be used. While testing I found, fields with Null are not rendered and fields with only a space(s) are converted to Null. (See this Wikipedia page for information on how to type a non-breaking space.)
  2. While setting the Layer Labeling Settings, on the Advanced tab, set the Placement to Over Point. Also set the Priority such that it is higher than any other labeled layers.

Depending on the size of the icon used, some experimentation may be required to get things to work as expected. Depending on the circumstance, it may be easier to use multiple characters rather than attempting to increase the font weight and/or size.

Sample Map 2

Tested with QGIS 1.7 and a recently compiled of 1.8 on Mac OS 10.7.4.

share|improve this question
    
You can also answer your own questions. I would like to vote your solution up. –  underdark Jun 17 '12 at 9:06
add comment

3 Answers 3

up vote 2 down vote accepted

The best consistent solution I have so far is along the lines of what I have laid out above. Assuming a SHP file is used, the steps are:

  1. Open the dbf file either with a spreadsheet application such as LibreOffice, Excel, or the QGIS Table Manager plugin.
  2. Add a column to the table. If a data type is required, use string.
  3. Fill the cells with a non-breaking space. Once complete, save the changes. (See this Wikipedia page for information on how to type a non-breaking space.)
  4. Open the Layer Labeling Settings for the point layer. On the Advanced tab, set the Placement to Over Point and set the Priority such that it is higher than any other labeled layers.
share|improve this answer
add comment

I know this is old but you could add an "X Coordinate" and "Y Coordinate" (double precision) column to the table that holds that information and then go to the "Data Defined Settings" tab under Labels in the layer properties and change X coordinate and Y coordinate accordingly. Once you do that you can move the label by freehand using the move label button.

share|improve this answer
add comment

Have you toyed with the offset of the label? I find that allows label positioning to be more dynamic, if I set it to 2 mm or so. ciao

share|improve this answer
    
No, I have not attempted to do this. The main reason I have not altered the label positioning is because on other areas of the map (not pictured), the road network is considerably denser. In the example above, moving the icon by about 2mm (any direction) would correct the problem. However on other parts of the map, it would likely push the icon deeper into another label. –  DMan Jun 17 '12 at 2:06
    
Give it a go, the label will likely shift to a new dynamic position. Maybe not what you want, but only way to find out is to try. The option I use is in the advanced tab of the new label tool (which is found in the toolbar not the from the properties dialog of the layer). –  Willy Jun 17 '12 at 6:54
add comment

Your Answer

 
discard

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.