66 VSILFILE *vsifp = NULL;
78 bytea_data = (bytea *) PG_GETARG_BYTEA_P(0);
80 data_len = VARSIZE(bytea_data) - VARHDRSZ;
88 vsifp = VSIFileFromMemBuffer(
"/vsimem/in.dat",
data, data_len,
FALSE);
90 PG_FREE_IF_COPY(bytea_data, 0);
91 elog(ERROR,
"RASTER_fromGDALRaster: Could not load bytea into memory file for use by GDAL");
100 if (hdsSrc == NULL) {
102 PG_FREE_IF_COPY(bytea_data, 0);
103 elog(ERROR,
"RASTER_fromGDALRaster: Could not open bytea with GDAL. Check that the bytea is of a GDAL supported format");
107 #if POSTGIS_DEBUG_LEVEL > 3
109 GDALDriverH hdrv = GDALGetDatasetDriver(hdsSrc);
112 GDALGetDriverShortName(hdrv),
113 GDALGetRasterXSize(hdsSrc),
114 GDALGetRasterYSize(hdsSrc)
124 PG_FREE_IF_COPY(bytea_data, 0);
127 elog(ERROR,
"RASTER_fromGDALRaster: Could not convert GDAL raster to raster");
140 SET_VARSIZE(pgraster, pgraster->
size);
141 PG_RETURN_POINTER(pgraster);
int clamp_srid(int srid)
Return a valid SRID from an arbitrary integer Raises a notice if what comes out is different from wha...
int rt_util_gdal_register_all(int force_register_all)
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
rt_raster rt_raster_from_gdal_dataset(GDALDatasetH ds)
Return a raster from a GDAL dataset.
GDALDatasetH rt_util_gdal_open(const char *fn, GDALAccess fn_access, int shared)
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster's SRID.
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
#define POSTGIS_RT_DEBUGF(level, msg,...)