PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ copy_rastinfo()

static int copy_rastinfo ( RASTERINFO dst,
RASTERINFO src 
)
static

Definition at line 520 of file raster2pgsql.c.

520 {
521 if (src->srs != NULL) {
522 dst->srs = rtalloc(sizeof(char) * (strlen(src->srs) + 1));
523 if (dst->srs == NULL) {
524 rterror(_("copy_rastinfo: Not enough memory"));
525 return 0;
526 }
527 strcpy(dst->srs, src->srs);
528 }
529 memcpy(dst->dim, src->dim, sizeof(uint32_t) * 2);
530 dst->nband_count = src->nband_count;
531 if (src->nband_count && src->nband != NULL) {
532 dst->nband = rtalloc(sizeof(int) * src->nband_count);
533 if (dst->nband == NULL) {
534 rterror(_("copy_rastinfo: Not enough memory"));
535 return 0;
536 }
537 memcpy(dst->nband, src->nband, sizeof(int) * src->nband_count);
538 }
539 if (src->gdalbandtype != NULL) {
540 dst->gdalbandtype = rtalloc(sizeof(GDALDataType) * src->nband_count);
541 if (dst->gdalbandtype == NULL) {
542 rterror(_("copy_rastinfo: Not enough memory"));
543 return 0;
544 }
545 memcpy(dst->gdalbandtype, src->gdalbandtype, sizeof(GDALDataType) * src->nband_count);
546 }
547 if (src->bandtype != NULL) {
548 dst->bandtype = rtalloc(sizeof(rt_pixtype) * src->nband_count);
549 if (dst->bandtype == NULL) {
550 rterror(_("copy_rastinfo: Not enough memory"));
551 return 0;
552 }
553 memcpy(dst->bandtype, src->bandtype, sizeof(rt_pixtype) * src->nband_count);
554 }
555 if (src->hasnodata != NULL) {
556 dst->hasnodata = rtalloc(sizeof(int) * src->nband_count);
557 if (dst->hasnodata == NULL) {
558 rterror(_("copy_rastinfo: Not enough memory"));
559 return 0;
560 }
561 memcpy(dst->hasnodata, src->hasnodata, sizeof(int) * src->nband_count);
562 }
563 if (src->nodataval != NULL) {
564 dst->nodataval = rtalloc(sizeof(double) * src->nband_count);
565 if (dst->nodataval == NULL) {
566 rterror(_("copy_rastinfo: Not enough memory"));
567 return 0;
568 }
569 memcpy(dst->nodataval, src->nodataval, sizeof(double) * src->nband_count);
570 }
571 memcpy(dst->gt, src->gt, sizeof(double) * 6);
572 memcpy(dst->tile_size, src->tile_size, sizeof(int) * 2);
573
574 return 1;
575}
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
Definition rt_context.c:199
void * rtalloc(size_t size)
Wrappers used for managing memory.
Definition rt_context.c:171
rt_pixtype
Definition librtcore.h:185
#define _(String)
Definition shpcommon.h:24
double * nodataval
rt_pixtype * bandtype
double gt[6]
uint32_t nband_count
GDALDataType * gdalbandtype
uint32_t dim[2]

References _, rasterinfo_t::bandtype, rasterinfo_t::dim, rasterinfo_t::gdalbandtype, rasterinfo_t::gt, rasterinfo_t::hasnodata, rasterinfo_t::nband, rasterinfo_t::nband_count, rasterinfo_t::nodataval, rtalloc(), rterror(), rasterinfo_t::srs, and rasterinfo_t::tile_size.

Referenced by process_rasters().

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