.. _label_obstacles:
Label Obstacles
===============
GeoServer implements an algorithm for label conflict
resolution, to prevent labels from overlapping one another.
By default this algorithm only considers conflicts with other labels.
This can result in labels
overlapping other symbolizers, which may produce an undesirable effect.
.. cssclass:: no-border
.. figure:: images/label-obstacle1.jpg
.. figure:: images/label-obstacle2.jpg
GeoServer supports a vendor option called ``labelObstacle`` that allows
marking a symbolizer as an obstacle.
This tells the labeller to avoid rendering labels that overlap it.
.. code-block:: xml
image/png
32
true
.. cssclass:: no-border
.. figure:: images/obs-externalGraphic1.png
.. figure:: images/obs-externalGraphic2.png
Applying the obstacle to a regular point style:
.. code-block:: xml
image/png
32
true
.. cssclass:: no-border
.. figure:: images/obs-mark1.png
.. figure:: images/obs-mark2.png
Applying the obstacle to line/polygon style style:
.. cssclass:: no-border
.. figure:: images/obs-line1.png
.. figure:: images/obs-line2.png
.. figure:: images/obs-poly1.png
.. figure:: images/obs-poly2.png
.. warning::
Beware of marking a line or poly symbolizer as a label obstacle. The label conflict resolving routine is
based on the bounding box so marking as a label obstacle will result in no label overlapping not only
the geometry itself, but its bounding box as well.