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

◆ copy_rastinfo()

static int copy_rastinfo ( RASTERINFO dst,
RASTERINFO src 
)
static

Definition at line 531 of file raster2pgsql.c.

531 {
532 if (src->srs != NULL) {
533 dst->srs = rtalloc(sizeof(char) * (strlen(src->srs) + 1));
534 if (dst->srs == NULL) {
535 rterror(_("copy_rastinfo: Not enough memory"));
536 return 0;
537 }
538 strcpy(dst->srs, src->srs);
539 }
540 memcpy(dst->dim, src->dim, sizeof(uint32_t) * 2);
541 dst->nband_count = src->nband_count;
542 if (src->nband_count && src->nband != NULL) {
543 dst->nband = rtalloc(sizeof(int) * src->nband_count);
544 if (dst->nband == NULL) {
545 rterror(_("copy_rastinfo: Not enough memory"));
546 return 0;
547 }
548 memcpy(dst->nband, src->nband, sizeof(int) * src->nband_count);
549 }
550 if (src->gdalbandtype != NULL) {
551 dst->gdalbandtype = rtalloc(sizeof(GDALDataType) * src->nband_count);
552 if (dst->gdalbandtype == NULL) {
553 rterror(_("copy_rastinfo: Not enough memory"));
554 return 0;
555 }
556 memcpy(dst->gdalbandtype, src->gdalbandtype, sizeof(GDALDataType) * src->nband_count);
557 }
558 if (src->bandtype != NULL) {
559 dst->bandtype = rtalloc(sizeof(rt_pixtype) * src->nband_count);
560 if (dst->bandtype == NULL) {
561 rterror(_("copy_rastinfo: Not enough memory"));
562 return 0;
563 }
564 memcpy(dst->bandtype, src->bandtype, sizeof(rt_pixtype) * src->nband_count);
565 }
566 if (src->hasnodata != NULL) {
567 dst->hasnodata = rtalloc(sizeof(int) * src->nband_count);
568 if (dst->hasnodata == NULL) {
569 rterror(_("copy_rastinfo: Not enough memory"));
570 return 0;
571 }
572 memcpy(dst->hasnodata, src->hasnodata, sizeof(int) * src->nband_count);
573 }
574 if (src->nodataval != NULL) {
575 dst->nodataval = rtalloc(sizeof(double) * src->nband_count);
576 if (dst->nodataval == NULL) {
577 rterror(_("copy_rastinfo: Not enough memory"));
578 return 0;
579 }
580 memcpy(dst->nodataval, src->nodataval, sizeof(double) * src->nband_count);
581 }
582 memcpy(dst->gt, src->gt, sizeof(double) * 6);
583 memcpy(dst->tile_size, src->tile_size, sizeof(int) * 2);
584
585 return 1;
586}
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
Definition rt_context.c:191
rt_pixtype
Definition librtcore.h:188
#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: