PostGIS update

From gnewarchaeology wiki
Revision as of 16:09, 12 December 2016 by Dncgst (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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