Displaying 1 result from an estimated 1 matches for "postgisraster".
2013 Oct 08
0
PostGIS 2.1 rasters available to Rails code: breadcrumbs
...ter band values out of PostGIS 2.1 rasters as Ruby arrays.
# This example assumes that the raster column is ''rast'' and that the primary
# key for the table is ''rid''. Also, NULL pixels will probably tank the getter.
# Fixing those is left as an exercise :-)
class PostGisRaster < ActiveRecord::Base
self.primary_key = ''rid''
# Grab a band of a raster out of the database and convert it to a 2D array. Defaults to first band (1)
def self.to_a(tablename,id,band=1)
id = id.to_i
str = connection.select_value("select st_dumpvalues(rast,#{ba...