.. _randomized:
Fills with randomized symbols
=============================
Starting with GeoServer 2.4.2 it is possible to generate fills by randomly repeating a symbol in the polygons to be filled.
Or, to be more precise, generate the usual texture fill by repeating over and over a tile, whose contents is the random repetition of a fill.
The random distribution is stable, so it will be the same across calls and tiles, and it's controlled by the seed used to generate the distribution.
The random fill is generated by specifying a GraphicFill with a Mark or ExternalGraphic, and then adding vendor options to control how the
symbol is randomly repeated. Here is a table with options, default values, and possible values:
.. list-table::
:widths: 20 10 70
:header-rows: 1
* - Option
- Default value
- Description
* - random
- none
- Activates random distribution of symbol. Possible values are **none**, **free**, **grid**.
**none** disables random distribution,
**free** generates a completely random distribution, **grid** will generate a regular grid of positions, and only randomizes the
position of the symbol around the cell centers, providing a more even distribution in space
* - random-tile-size
- 256
- Size the the texture fill tile that will contain the randomly distributed symbols
* - random-rotation
- none
- Activates random symbol rotation. Possible values are **none** (no rotation) or **free**
* - random-symbol-count
- 16
- The number of symbols in the tile. The number of symbols actually painted can be lower, as the distribution will ensure no
two symbols overlap with each other.
* - random-seed
- 0
- The "seed" used to generate the random distribution. Changing this value will result in a different symbol distribution
Here is an example:
.. code-block:: xml
shape://slash
#0000ff
round
4
8
5
grid
100
free
50
.. figure:: images/random-slash.png
:align: center
*Random distribution of a diagonal line*
Randomized distributions can also be used for thematic mapping, for example, here is the SLD for a version of topp:states that displays the number of inhabitantìs varying the density of a random point distribution:
.. code-block:: xml
Default Styler
name
PERSONS
2000000
PERSONS
4000000
circle
#a9a9a9
2
grid
100
150
PERSONS
2000000
circle
#a9a9a9
2
grid
100
50
PERSONS
4000000
circle
#a9a9a9
2
grid
100
500
.. figure:: images/states-random.png
:align: center
*Thematic map via point density approach*