<!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.16481" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>Sindile,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>If a polygon has one or more point features and you
want to transfer the attributes from the point feature to the polygon feature,
then what do you do in cases where there are multiple points in a
polygon</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>would you</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>1) pick the first one you hit</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>2) Sum up, take the max etc. of
each</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>3) Duplicate the poly for each
point?</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>In all cases, you will want to do an intersect
check</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>(solution 1)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>SELECT DISTINCT ON(poly.gid) poly.gid, poly.the_geom,
point.somefield1 As somefield1, point.somefield2 As
somefield2</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>FROM</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>table1 As poly INNER JOIN table2 As
point</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>ON ST_Intersects(poly.the_geom,
point.the_geom)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>ORDER BY poly.gid, point.gid;</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008></SPAN></FONT><FONT face=Arial color=#0000ff
size=2><SPAN
class=025074911-06102008></SPAN></FONT> </DIV></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>(solution to 2 would look something like
this)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>SELECT poly.gid, poly.the_geom, SUM(point.somefield1)
As totsomefield1, MAX(point.somefield2) As maxsomefield2</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>FROM</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>table1 As poly INNER JOIN table2 As
point</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>ON ST_Intersects(poly.the_geom,
point.the_geom)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>GROUP BY poly.gid, poly.the_geom;</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>(solution to 3)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008><SPAN class=025074911-06102008>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>SELECT poly.gid, poly.the_geom, point.somefield1 As
somefield1, point.somefield2 As somefield2</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>FROM</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>table1 As poly INNER JOIN table2 As
point</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>ON ST_Intersects(poly.the_geom,
point.the_geom)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>Hope that helps,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008>Regina</SPAN></FONT></DIV></SPAN></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=025074911-06102008></SPAN></FONT> </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>Intengu Technologies<BR><B>Sent:</B> Monday, October 06, 2008 4:47
AM<BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B> [postgis-users]
Newbie question - Transfer attributes from onefeature to
another<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr>I have a polygon (table1) and a point (table2) feature and would
want to transfer attributes from the point feature to the polygon feature based
on whether the point feature is completely enclosed by the polygon
feature.<BR>The polygon feature can have one or more point features.<BR><BR>How
do i transfer the attributes.<BR><BR clear=all><BR>-- <BR>Sindile
Bidla<BR></DIV></BODY></HTML>
<HTML><BODY><P><hr size=1></P>
<P><STRONG>
The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
</STRONG></P></BODY></HTML>
<P><hr size=1></P>
<P><STRONG><font size="2" color="339900"> Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper. </p> <p> </font></STRONG></P>