If it was the overall density of the dots that mattered and not as much the exact number of dots, a representative table could be made with a "random yet even" set of dots covering a certain area. To apply to a polygon, you could then Scale the data to the appropriate density and translate/compute the intersection to apply to a given polygon.<br>

<br><div class="gmail_quote">On Thu, May 6, 2010 at 12:50 PM, Martin Davis <span dir="ltr"><<a href="mailto:mbdavis@refractions.net">mbdavis@refractions.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Did your algorithm work with irregular polgon extents?<div><div></div><div class="h5"><br>
<br>
Jan Hartmann wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I did this long ago. Regular points won't work, you'll get all kinds of moire patterns. I just computed random x and y values from the origin of the grid cell within the x- and y grid-size. Can't remember having any problems with overlapping points.<br>


<br>
Jan<br>
<br>
On 05/06/10 19:35, Paul Ramsey wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Even-yet-random :) nice requirement. How about just starting with a<br>
regular grid and then perturbing the elements randomly with a radius<br>
of a cell size? You can use the area of the polygon and number of<br>
needed points to calculate the appropriate cell size and go from<br>
there.<br>
<br>
P<br>
<br>
On Thu, May 6, 2010 at 10:28 AM, Martin Davis<<a href="mailto:mbdavis@refractions.net" target="_blank">mbdavis@refractions.net</a>>  wrote:<br>
  <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Good point about the need for even distribution of the points. That seems<br>
like a whole lot harder to code than simply randomly placing points in a<br>
polygon.  Does anyone have any pointers to algorithms for producing this<br>
effect?<br>
<br>
George Silva wrote:<br>
    <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The really big problem with dot density is that dots can overlap<br>
themselves,<br>
masking the real number, so if anything will be developed in this area,<br>
the<br>
points should be<br>
<br>
A) evenly distributed<br>
or<br>
B) randomly distributed, but with some sort of "colision" tests, so there<br>
is<br>
no or little overlap.<br>
<br>
This is a interesting idea, especially if we could make a materialized<br>
view<br>
with those points, which could be added to GIS software for presentation.<br>
<br>
George<br>
<br>
On Thu, May 6, 2010 at 1:53 PM, Sufficool, Stanley<<br>
<a href="mailto:ssufficool@rov.sbcounty.gov" target="_blank">ssufficool@rov.sbcounty.gov</a>>  wrote:<br>
<br>
<br>
      <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Looks nasty, but it might work:<br>
<br>
select<br>
st_line_interpolate_point(<br>
       st_intersection(<br>
               the_geom,<br>
               st_makeline(<br>
                       st_pointn(st_exteriorring(the_geom), (rand1.rand *<br>
st_npoints(st_exteriorring(the_geom)))::int),<br>
                       st_pointn(st_exteriorring(the_geom), (rand2.rand *<br>
st_npoints(st_exteriorring(the_geom)))::int)<br>
               )<br>
       )<br>
       ,rand3.rand<br>
)<br>
from insert_your_table_name_here,<br>
(select random() as rand, generate_series(1,1000) as point_number) as<br>
rand1<br>
JOIN (select random() as rand, generate_series(1,1000) as point_number)<br>
as<br>
rand2<br>
       ON rand1.point_number = rand2.point_number<br>
JOIN (select random() as rand, generate_series(1,1000) as point_number)<br>
as<br>
rand3<br>
       ON rand2.point_number = rand3.point_number<br>
WHERE st_geometrytype(<br>
       st_intersection(<br>
               the_geom,<br>
               st_makeline(<br>
                       st_pointn(st_exteriorring(the_geom), (rand1.rand *<br>
st_npoints(st_exteriorring(the_geom)))::int),<br>
                       st_pointn(st_exteriorring(the_geom), (rand2.rand *<br>
st_npoints(st_exteriorring(the_geom)))::int)<br>
               )<br>
       )<br>
) = 'ST_LineString'<br>
AND oid = 5030 /* Enter your own OID here */<br>
limit 100<br>
<br>
<br>
<br>
<br>
        <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-----Original Message-----<br>
From: <a href="mailto:postgis-users-bounces@postgis.refractions.net" target="_blank">postgis-users-bounces@postgis.refractions.net</a><br>
[mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net" target="_blank">postgis-users-bounces@postgis.refractions.net</a>] On<br>
Behalf Of Martin Davis<br>
Sent: Thursday, May 06, 2010 8:56 AM<br>
To: John Abraham; <a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a>; Martin Davis<br>
Subject: Re: [postgis-users] Dot Density idea<br>
<br>
<br>
I was thinking the same thing!<br>
<br>
strk wrote:<br>
<br>
          <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
ST_RandomPoinsOnSurface(geometry, numpoints) would be an interesting<br>
function indeed. Sounds like a good job for GEOS/JTS.<br>
<br>
--strk;<br>
<br>
On Mon, May 03, 2010 at 10:49:32PM -0600, John Abraham wrote:<br>
<br>
<br>
            <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
One of the things I miss about using ESRI's GIS is the<br>
<br>
               <br>
</blockquote></blockquote>
ability to do<br>
<br>
          <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
dot-density maps.  Within a polygon, the number of dots is<br>
<br>
               <br>
</blockquote></blockquote>
proportional to a value, and the dots are randomly placed.  I<br>
find it useful to be able to present several data values at<br>
once (e.g. blue dots for population, red dots for employment).<br>
<br>
          <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I also find that it is a more intuitive way of scaling for<br>
<br>
               <br>
</blockquote></blockquote>
zone size<br>
<br>
          <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
than dividing the value by the area of the zone.  That is,<br>
<br>
               <br>
</blockquote></blockquote>
the count<br>
<br>
          <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
of the dots represents the actual number, but the density<br>
<br>
               <br>
</blockquote></blockquote>
of the dots<br>
<br>
          <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
represents the density of the number.  So I don't have to decide<br>
whether to divide the value by the area of the polygon to plot<br>
density: both the absolute number and the density are<br>
<br>
               <br>
</blockquote></blockquote>
easily visible.<br>
<br>
          <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Since my open-source GIS viewing systems (mostly QGIS and<br>
<br>
               <br>
</blockquote></blockquote>
Mapserver)<br>
<br>
          <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
won't plot dot-density, I've done without.<br>
<br>
But today I realized that I can build these on the server<br>
<br>
               <br>
</blockquote></blockquote>
instead.  I<br>
<br>
          <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
can generate random points within the bounding-box of the polygon,<br>
throwing out those that aren't contained within the polygon,<br>
repeating until I have enough.  Then I can save these points as a<br>
separate layer, and display this layer using almost any desktop or<br>
web based viewer!<br>
<br>
Has anyone done this?  Can I do it in SQL or do I need to write<br>
something in PL/pgsql?<br>
<br>
-- <br>
John Abraham<br>
<br>
PS I just bought the Postgis In Action book; enjoying it so far.<br>
_______________________________________________<br>
postgis-users mailing list <a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br>
<br>
               <br>
</blockquote>
<br>
             <br>
</blockquote>
-- <br>
Martin Davis<br>
Senior Technical Architect<br>
Refractions Research, Inc.<br>
(250) 383-3022<br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br>
<br>
           <br>
</blockquote>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br>
<br>
         <br>
</blockquote>
<br>
<br>
  ------------------------------------------------------------------------ <br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br>
       <br>
</blockquote>
-- <br>
Martin Davis<br>
Senior Technical Architect<br>
Refractions Research, Inc.<br>
(250) 383-3022<br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br>
     <br>
</blockquote>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
   <br>
</blockquote>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br>
</blockquote>
<br></div></div>
-- <br><div><div></div><div class="h5">
Martin Davis<br>
Senior Technical Architect<br>
Refractions Research, Inc.<br>
(250) 383-3022<br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>************************************<br>David William Bitner<br>