<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16825" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=750220419-20042009><FONT face=Arial
color=#0000ff size=2>reference was meant to be just an example table your grid
is in. If you don't have any then you don't really need the inner join
except for not having to repeat the same static geometry
twice</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=750220419-20042009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=750220419-20042009><FONT face=Arial
color=#0000ff size=2>So below I defined a static geometry to represent by grid
geom -- ST_Buffer(ST_Point(1,2),3) replace this with your grid
polygon</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=750220419-20042009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=750220419-20042009>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2>SELECT
ST_Centroid(ST_Collect(ST_Intersection(r.the_geom,p.the_geom))) As
the_centroid</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial><FONT
color=#0000ff><FONT size=2>FROM tblpolygons As p<SPAN class=750220419-20042009>
INNER JOIN (SELECT ST_Buffer(ST_Point(1,2),3) As the_geom) As
r</SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2><SPAN class=750220419-20042009>ON ST_Intersects(r.the_geom,
p.the_geom)</SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2><SPAN
class=750220419-20042009></SPAN></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2><SPAN
class=750220419-20042009></SPAN></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2><SPAN class=750220419-20042009><SPAN
class=750220419-20042009><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2><SPAN
class=750220419-20042009></SPAN></FONT></SPAN> </DIV></SPAN></SPAN></FONT></SPAN></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of </B>Bob
Pawley<BR><B>Sent:</B> Monday, April 20, 2009 12:05 PM<BR><B>To:</B> PostGIS
Users Discussion<BR><B>Subject:</B> Re: [postgis-users] Reference
Grid<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2>Hi Regina</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks for the help.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I don't understand "<FONT color=#0000ff> INNER JOIN
reference As r ON".</FONT></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><FONT color=#000000>I get the
error</FONT> <FONT color=#000000>- > relation "reference" does not
exist.</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>It doesn't like my substitution for reference
either.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Bob</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Bob</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=lr@pcorp.us href="mailto:lr@pcorp.us">Paragon Corporation</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=postgis-users@postgis.refractions.net
href="mailto:postgis-users@postgis.refractions.net">'PostGIS Users
Discussion'</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Sunday, April 19, 2009 8:58
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [postgis-users] Reference
Grid</DIV>
<DIV><BR></DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2>Bob,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2>Does the below help any. The below will give you
the centroid of the portion of geometries that intersect a reference grid
where the grid of the reference is defined by
reference.the_geom</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2>SELECT r.gid, r.the_geom,
ST_Centroid(ST_Collect(ST_Intersection(r.the_geom,p.the_geom))) As
the_centroid</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2>FROM tblpolygons As p INNER JOIN reference As r ON
ST_Intersects(p.the_geom, r.the_geom)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2>GROUP BY r.gid, r.the_geom</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2>Hope that helps,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=797145403-20042009><FONT face=Arial
color=#0000ff size=2>Regina</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of </B>Bob
Pawley<BR><B>Sent:</B> Sunday, April 19, 2009 1:58 PM<BR><B>To:</B> PostGIS
Users Discussion<BR><B>Subject:</B> [postgis-users] Reference
Grid<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2>Hi</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I'm using a reference grid of small
polygons.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have been trying to collect concurrent polygons
into one geometry in order to establish the centroid of the region covered.
I've tried a number of operations such as union, contains, accum
etc.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I haven't been successful.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Can anyone give me some ideas??</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Bob</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>postgis-users
mailing
list<BR>postgis-users@postgis.refractions.net<BR>http://postgis.refractions.net/mailman/listinfo/postgis-users<BR></BLOCKQUOTE></BODY></HTML>