PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ make_sql_addrastercolumn()

def raster2pgsql.make_sql_addrastercolumn (   options,
  pixeltypes,
  nodata,
  pixelsize,
  blocksize,
  extent 
)

Definition at line 383 of file raster2pgsql.py.

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

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

Referenced by wkblify_raster_level().

Here is the call graph for this function:
Here is the caller graph for this function: