PostGIS update

From gnewarchaeology wiki
Jump to: navigation, search
PostGIS > PostGIS update



Update a MultiPointZ table from a PointZ table, collecting geoms

# UPDATE geo AS foo SET multigeom = bar.geom
  FROM (
       SELECT p.geo, p.unit, ST_Multi(ST_Collect(p.geom)) AS geom FROM geo_point as p GROUP BY p.geo, p.unit
       ) AS bar
  WHERE foo.geo = bar.geo and foo.unit = bar.unit;

Update lat lon columns from geom