Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

CartoDB VisualRaster For Deforestation

CartoDB VisualRaster For Deforestation

2012 Foss4G NA Presentation

Andrew W Hill

April 17, 2012
Tweet

More Decks by Andrew W Hill

Other Decks in Science

Transcript

  1. UPDATE hapctnpp_geotiff SET rast = ST_MapAlgebraExpr(rast, '8BUI', 'CASE WHEN [rast]

    = 0 THEN 10 WHEN [rast] = 255 THEN 11 ELSE floor([rast]/32)::int END') ; Down-sampling
  2. Raster to polygons select st_multi( st_makevalid( (geomval).geom) ) as the_geom,

    (geomval).val as value from (select ST_DumpAsPolygons(rast) as geomval from hapctnpp_geotiff) f
  3. Spatial query WITH foo AS ( SELECT ST_AsRaster(triangle.the_geom, rast )

    AS rast FROM triangle, hapctnpp_geotiff WHERE ST_Intersects(triangle.the_geom,rast) LIMIT 1) SELECT (ST_SummaryStats(ST_Union(ST_MapAlgebraExpr(m. rast, f.rast, '[rast1.val]', '16BUI')))).* as rast FROM hapctnpp_geotiff m JOIN foo f ON ST_Intersects(m.rast, f.rast);