384 assert len(pixeltypes) > 0,
"No pixel types given"
389 if nodata
is not None and len(nodata) > 0:
398 bs = (
'null',
'null' )
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"
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)
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)
419 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)