Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. key val
  2. ------------
  3. 0 -999
  4. 1 100
  5.  
  6. DROP TABLE IF EXISTS lookup;
  7. CREATE TEMP TABLE lookup
  8. AS
  9. SELECT *
  10. FROM (
  11. VALUES (0,-99999::numeric), (1,100::numeric)
  12. ) AS t (key, val);
  13.  
  14. UPDATE my_rast SET rast =
  15. ST_Reclass(rast,
  16. ROW(1, (SELECT string_agg(concat('[',key,'-',key,']:', val), ',') FROM lookup), '16BSI', 0)::reclassarg)
  17.  
  18. UPDATE bin_rast SET reclass_rast = ST_Reclass(bin_rast, 1, '0:-999, 1:100', '8BUI', 0)
  19. WHERE rid = 1;
  20.  
  21. SELECT string_agg(concat(key,':', val)::text, ',') FROM lookup;
  22.  
  23. UPDATE bin_rast SET reclass_rast =
  24. ST_Reclass(bin_rast, 1,
  25. (select concat('''',string_agg(concat(key,':', val)::text, ','), '''')
  26. FROM lookup)::regclassexpr,
  27. '8BUI', 0)
  28. WHERE rid = 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement