Regina, Solution 3 is would work fine, but was hoping for a solution to transfer the attributes into one field without duplicating the poly.
Thanks for the pointer. 2008/10/6 Obe, Regina <[EMAIL PROTECTED]> > Sindile, > > 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 > > would you > > 1) pick the first one you hit > 2) Sum up, take the max etc. of each > 3) Duplicate the poly for each point? > > In all cases, you will want to do an intersect check > > (solution 1) > SELECT DISTINCT ON(poly.gid) poly.gid, poly.the_geom, point.somefield1 As > somefield1, point.somefield2 As somefield2 > FROM > table1 As poly INNER JOIN table2 As point > ON ST_Intersects(poly.the_geom, point.the_geom) > ORDER BY poly.gid, point.gid; > > (solution to 2 would look something like this) > SELECT poly.gid, poly.the_geom, SUM(point.somefield1) As totsomefield1, > MAX(point.somefield2) As maxsomefield2 > FROM > table1 As poly INNER JOIN table2 As point > ON ST_Intersects(poly.the_geom, point.the_geom) > GROUP BY poly.gid, poly.the_geom; > > (solution to 3) > SELECT poly.gid, poly.the_geom, point.somefield1 As somefield1, > point.somefield2 As somefield2 > FROM > table1 As poly INNER JOIN table2 As point > ON ST_Intersects(poly.the_geom, point.the_geom) > > Hope that helps, > Regina > > > > > > ------------------------------ > *From:* [EMAIL PROTECTED] [mailto: > [EMAIL PROTECTED] *On Behalf Of *Intengu > Technologies > *Sent:* Monday, October 06, 2008 4:47 AM > *To:* PostGIS Users Discussion > *Subject:* [postgis-users] Newbie question - Transfer attributes from > onefeature to another > > 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. > The polygon feature can have one or more point features. > > How do i transfer the attributes. > > > -- > Sindile Bidla > > ------------------------------ > > * 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. * > > ------------------------------ > > * Help make the earth a greener place. If at all possible resist printing > this email and join us in saving paper. * > > > _______________________________________________ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > > -- Sindile Bidla
_______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users