CartoDB VisualRaster For Deforestation

CartoDB VisualRaster For Deforestation

2012 Foss4G NA Presentation

35f4d000a88cdbcf6392dfb206ebd5e2?s=128

Andrew W Hill

April 17, 2012
Tweet

Transcript

  1. None
  2. Intro to cartodb

  3. Cartodb + PostGIS2.0

  4. Raster

  5. show drag drop

  6. SELECT (ST_SummaryStats(rast)).* FROM hapctnpp_geotiff

  7. None
  8. None
  9. 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
  10. 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
  11. None
  12. https://viz2.cartodb.com/tables/ pop_density_bins/embed_map?sql=select %20the_geom_webmercator%2C %20population%20from %20pop_density_bins%20

  13. None
  14. None
  15. 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);
  16. None
  17. DEMO

  18. Thoughts

  19. tiling of tiffs unknown

  20. performance improvements still needed

  21. Maps API support still needed