In my last post I talked about the request on the PostGIS list for a function to generate dot-density maps, and about a JTS class to implement it.
Currently the JTS implementation uses purely random points. Here's what a field of purely random points looks like:
As a few people pointed out, and as is obvious from the image, this doesn't look that great, since there tends to be a lot of clusters and blank areas. This doesn't give a very aesthetic effect when used for cartographic purposes.
So I experimented with a few other options.
Here's random points generated in a grid of cells (one point randomly located in each cell). Better, but there are still clusters and blank areas.
Following an idea by Paul Ramsey, here's a grid where the random points are located in circles centred on each grid cell. This is an improvementl, but still doesn't prevent points from ending up close together.
Next idea: use square cells, but add a "gutter" between each cell. No points are created in the gutter, ensuring that points cannot be closer than the gutter width. In this image the gutter width is 30% of the overall cell width.
Much better, I think. Although, as the gutter size increases, the underlying grid becomes apparent. Here's a 50% gutter:
Maybe's there's still improvements that can be made.... It would be nice to avoid the grid effect, and also to reduce the use of a gutter (which skews the density of the distribution).
As David William Bitner pointed out, these can all be restricted to polygonal areas by simply intersecting the point field with the polygon.
Integration Tests in the Pyramid
52 minutes ago