Using St_SnapToGrid is a way to do it. A simple algorithm could calculate the ideal distance between points depending on the number of resulting points and then just place them in correct place.<br><br>The way to do it is to inform attribute and the value of each dot. On the same note, a proportional symbols representation could be done, but that can be very tricky, since building the actual circles could give you extensive overlap, and they should change according to scale, so I guess that could be done by software. PostGIS could generate a view using the centroid for proportional symbols using a point a softwares need to take care of the representation.<br>

<br>George<br><br><div class="gmail_quote">On Thu, May 6, 2010 at 2:28 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: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Good point about the need for even distribution of the points. That seems like a whole lot harder to code than simply randomly placing points in a polygon.  Does anyone have any pointers to algorithms for producing this effect?<br>


<br>
George Silva wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5">
The really big problem with dot density is that dots can overlap themselves,<br>
masking the real number, so if anything will be developed in this area, 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 is<br>
no or little overlap.<br>
<br>
This is a interesting idea, especially if we could make a materialized 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>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); 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 rand1<br>
JOIN (select random() as rand, generate_series(1,1000) as point_number) as<br>
rand2<br>
       ON rand1.point_number = rand2.point_number<br>
JOIN (select random() as rand, generate_series(1,1000) as point_number) 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>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); 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>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); 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>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
One of the things I miss about using ESRI's GIS is the<br>
          <br>
</blockquote></blockquote>
ability to do<br>
      <br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


dot-density maps.  Within a polygon, the number of dots is<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>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


I also find that it is a more intuitive way of scaling for<br>
          <br>
</blockquote></blockquote>
zone size<br>
      <br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


than dividing the value by the area of the zone.  That is,<br>
          <br>
</blockquote></blockquote>
the count<br>
      <br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


of the dots represents the actual number, but the density<br>
          <br>
</blockquote></blockquote>
of the dots<br>
      <br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); 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>
</blockquote></blockquote>
easily visible.<br>
      <br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


Since my open-source GIS viewing systems (mostly QGIS and<br>
          <br>
</blockquote></blockquote>
Mapserver)<br>
      <br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); 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>
</blockquote></blockquote>
instead.  I<br>
      <br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); 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>
</blockquote>
        <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>
    <br>
</blockquote>
<br>
<br>
<br></div></div>
  ------------------------------------------------------------------------<div class="im"><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>
</div></blockquote><div><div></div><div class="h5">
<br>
-- <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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>George R. C. Silva<br><br>Desenvolvimento em GIS<br><a href="http://blog.geoprocessamento.net">http://blog.geoprocessamento.net</a><br>