PostGIS  2.1.10dev-r@@SVN_REVISION@@
def raster2pgsql.make_sql_addrastercolumn (   options,
  pixeltypes,
  nodata,
  pixelsize,
  blocksize,
  extent 
)

Definition at line 385 of file raster2pgsql.py.

References logit(), make_sql_schema_table_names(), and make_sql_value_array().

Referenced by wkblify_raster_level().

385 def make_sql_addrastercolumn(options, pixeltypes, nodata, pixelsize, blocksize, extent):
386  assert len(pixeltypes) > 0, "No pixel types given"
387  ts = make_sql_schema_table_names(options.table)
388  pt = make_sql_value_array(pixeltypes)
389 
390  nd = 'null'
391  if nodata is not None and len(nodata) > 0:
392  nd = make_sql_value_array(nodata)
393 
394  odb = 'false'
395  if options.register:
396  odb = 'true'
397 
398  rb = 'false'
399  extgeom = 'null'
400  bs = ( 'null', 'null' )
401  # Check if regular blocking mode requested
402  if options.block_size is not None:
403  assert pixelsize is not None, "Pixel size is none, but regular blocking requested"
404  assert blocksize is not None, "Block size is none, but regular blocking requested"
405  assert extent is not None, "Extent is none, but regular blocking requested"
406  assert len(pixelsize) == 2, "Invalid pixel size, two values expected"
407  assert len(blocksize) == 2, "Invalid block size, two values expected"
408  assert len(extent) == 4, "Invalid extent, four coordinates expected"
409  assert len(extent[0]) == len(extent[3]) == 2, "Invalid extent, pair of X and Y pair expected"
410  rb = 'true'
411  bs = ( blocksize[0], blocksize[1] )
412  extgeom = "ST_Envelope(ST_SetSRID('POLYGON((%.15f %.15f,%.15f %.15f,%.15f %.15f,%.15f %.15f,%.15f %.15f))'::geometry, %d))" % \
413  (extent[0][0], extent[0][1], extent[1][0], extent[1][1],
414  extent[2][0], extent[2][1], extent[3][0], extent[3][1],
415  extent[0][0], extent[0][1], options.srid)
416 
417  sql = "SELECT AddRasterColumn('%s','%s','%s',%d, %s, %s, %s, %s, %.15f, %.15f, %s, %s, %s);\n" % \
418  (ts[0], ts[1], options.column, options.srid, pt, odb, rb, nd,
419  pixelsize[0], pixelsize[1], bs[0], bs[1], extgeom)
420 
421  logit("SQL: %s" % sql)
422  return sql
423 
def make_sql_value_array(values)
def logit(msg)
def make_sql_schema_table_names(schema_table)
def make_sql_addrastercolumn(options, pixeltypes, nodata, pixelsize, blocksize, extent)

Here is the call graph for this function:

Here is the caller graph for this function: