I have below query which I am supposed to import into QGIS by amending certain aspects, to find out exactly what it does. But when I try to run it on the corresponding PostGIS layer, DB Manager warns me that there is not such "geom" attribute. I don't know what to do then. Is it a syntax issue?

UPDATE c_risque.ppr_inondation_surf 
SET    geom = st_multi(st_simplify(st_multi(st_collectionextract(st_forcecollection(st_makevalid(st_snaptogrid(geom, 1))),3)),0))
WHERE  not st_equals(geom, st_multi(st_simplify(st_multi(st_collectionextract(st_forcecollection(st_makevalid(st_snaptogrid(geom, 1))),3)),0)));
  • 1
    Does c_risque.ppr_inondation_surf actually have a column named geom? Also, consider this: you test each rows geometry for <complicated_geometric_processing>, and if it's not equal, do and set complicated_geometric_processing>; while that seems to make sense, it would be faster to just set everything to <complicated_geometric_processing> (except you'd have a functional index on <complicated_geometric_processing>...which you likely don't want).
    – geozelot
    Dec 26 '19 at 18:29

Try the following :

1) ensure u really have a geometry column in your ppr_inondation_surf table (...)

2) reference the geometry column using 'geometry' instead of geom

PS : i think u can't launch update queries in QGIS Database Manager ("virtual layers") ...

  • am i wrong ? ...
    – Snaileater
    Jan 3 '20 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.