GeoTools

OSGeo

Friday, October 4, 2013

Randomized Fill

Quick cool new feature thanks to the always impressive @geowolf. Andrea is a man of few words and many examples so let me turn you over to his email.
Hi, 
The randomized fill support discussed some time ago has landed on trunk. 
Cheers 
Andrea 
PS: A note about the params and their default value:
  • random: false
  • random-seed: 0 (the seed for the random generator, change its value to get a different distribution at the same density)
  • random-symbol-count: 16
  • random-tile-size: 256 (the size of the tile... this default is large for small symbols... but ok for larger pictures...)
  • random-space-around: 0 (conflict resolution control, similar to labels, < 0 allows for overlap, > 0 pushes symbols further apart)
  • random-rotation: false (whether to randomly rotate the symbols as well, or not)
  • random-grid: true (if true the symbols are randomized around the centers of a regular grid, when false it's really fully random)
PPS: I'd wish to port it back to the stable series next month if nothing breaks
Thanks to New South Wales Geological Survey for sponsoring this work.

(Check out the original email for the XML code examples, click on the images for larger size).

Randomized Slash Symbols

Here is one with randomized "slash" symbols, with a background box fill that helps visualize the "unit" of the random fill, the image that is getting repeated over and over:
In this case the randomization is grid based, that is, symbols are not actually
spread out fully randomly, each of them is actually placed at a controlled random 
distance from the centers of an invisible grid. Random, but not completely so.

Fully Random without Rotation

Here is one fully random, and without random rotation. As you can see, there are some holes
in the pattern that the gridded version did not have.



Fully Random


Here is a fully random one, actually, two, superimposed (see how the seed got changed to avoid getting
the same point distribution twice in a row, which would have made the larger circles just cover the small ones).



Theme Example


As a closing example, the usual topp:states depicted using varying dot density: