For the Vector -> Research Tools -> Random Point -> Stratified sampling design, 
can we have:

Add "Proportional Value From Input Field" selection, where the user can select 
a floating point field, and then they could enter either:
1) Number of points on map, or
2) Value of each point.

If the user selects number of points, the algorithm would sum the positive 
numbers in all the polygons, and sum the absolute value of the negative 
numbers, and divide the max of these two sums by the number of points 
specified, to get the value-per-point.  (E.g. if the user specified 1000 
points, it would yield no more than 1000 points representing positive values, 
and no more than 1000 points representing negative values.)

Then the algorithm would iterate through the polygons and for each polygon 
would divide the absolute value of the user specified field by the 
value-per-point, round it to the nearest integer, and place that many random 
points in the polygon.  Each point would be labeled by the value of the field 
divided by the number of points.

Advantages over current Random Point -> Use value from Input Field:

1) Don't have to generate a new field representing the number of points, if you 
have a field representing something big and continuous, like Gross Domestic 
Product per state.
2) Don't have to figure out the value of each point in advance, can specify 
that you want 1000 points (for positive values) and get 1000 points generated.
3) Generates negative values as well as positive values (I often use blue dots 
for increases and red dots for decreases in dot-density maps.)
4) Random points are assigned a quantity such that the original value can be 
retrieved with a sum (i.e. although the number of dots is necessarily rounded 
to an integer, the
attribute on the dot values can vary between the different polygons.)  (Unless 
zero points are generated in the polygon.)
5) (related) works on floating point fields.


PS I have this working well in PostGIS and have used it for years.  Function 
attached.  It's just annoying to use if the data aren't in PostGIS already, and 
I'd like to rest of the QGIS community to have this cool functionality.  I 
always thought I'd implement this myself in QGIS code, but I'm starting to 
realize that I'm neck-deep in too many coding projects right now.  However I 
would buy beer or pay someone to implement this, if it helps speed it along.

--
John Abraham


Attachment: AddDotDensity.sql
Description: Binary data

_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to