385 assert len(pixeltypes) > 0,
"No pixel types given"
390 if nodata
is not None and len(nodata) > 0:
399 bs = (
'null',
'null' )
401 if options.block_size
is not None:
402 assert pixelsize
is not None,
"Pixel size is none, but regular blocking requested"
403 assert blocksize
is not None,
"Block size is none, but regular blocking requested"
404 assert extent
is not None,
"Extent is none, but regular blocking requested"
405 assert len(pixelsize) == 2,
"Invalid pixel size, two values expected"
406 assert len(blocksize) == 2,
"Invalid block size, two values expected"
407 assert len(extent) == 4,
"Invalid extent, four coordinates expected"
408 assert len(extent[0]) == len(extent[3]) == 2,
"Invalid extent, pair of X and Y pair expected"
410 bs = ( blocksize[0], blocksize[1] )
411 extgeom =
"ST_Envelope(ST_SetSRID('POLYGON((%.15f %.15f,%.15f %.15f,%.15f %.15f,%.15f %.15f,%.15f %.15f))'::geometry, %d))" % \
412 (extent[0][0], extent[0][1], extent[1][0], extent[1][1],
413 extent[2][0], extent[2][1], extent[3][0], extent[3][1],
414 extent[0][0], extent[0][1], options.srid)
416 sql =
"SELECT AddRasterColumn('%s','%s','%s',%d, %s, %s, %s, %s, %.15f, %.15f, %s, %s, %s);\n" % \
417 (ts[0], ts[1], options.column, options.srid, pt, odb, rb, nd,
418 pixelsize[0], pixelsize[1], bs[0], bs[1], extgeom)
420 logit(
"SQL: %s" % sql)
def make_sql_value_array(values)
def make_sql_addrastercolumn(options, pixeltypes, nodata, pixelsize, blocksize, extent)
def make_sql_schema_table_names(schema_table)