[postgis-users] Attributes update
Markus Schaber
schabi at logix-tt.com
Fri May 30 04:25:37 PDT 2008
Hi, Lucas,
"Lucas Mueller" <lucas.mueller at gmail.com> wrote:
> I have two polygon layers (let's say Parcels and Land_use). I would like to
> assign the attribute Land_use.type to the Parcels.landuse column by a query
> that assigns a certain land use type to a parcel if the centroid of the
> parcel is within a certain land use polygon. I hope to be clear enough...
> Any idea on how to proceed?
Try something like:
update land_use set type=(select parcels.landuse FROM parcels where
land_use.the_geom && parcels.the_geom AND
within(centroid(parcels.the_geom),land_use.the_geom));
Btw, I tend to mix up the argument order of within and contains, so
please double-check.
Regards,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org
More information about the postgis-users
mailing list