560 {
561 const char *filename = POSTGIS_TOP_SRC_DIR "/raster/test/regress/loader/Projected.tif";
562
563 GDALDatasetH hDS_in = NULL;
566 int band_count_in, band_count_out, i;
567
568
569
570
571
572
573
574 double max_err = 0.125;
575 GDALResampleAlg alg = GRA_NearestNeighbour;
576
577 const char *src_srs = "EPSG:4326";
578 const char *dst_srs = "EPSG:3857";
579
580
581 GDALAllRegister();
582 hDS_in = GDALOpen(filename, GA_ReadOnly);
583 CU_ASSERT(hDS_in != NULL);
584
585
587 CU_ASSERT(rast_in != NULL);
588
589
591 src_srs, dst_srs,
592 NULL, NULL,
593 NULL, NULL,
594 NULL, NULL,
595 NULL, NULL,
596 NULL, NULL,
597 alg, max_err);
598 CU_ASSERT(rast_out != NULL);
599
602 CU_ASSERT_EQUAL(band_count_in, band_count_out);
603
604 for (i = 0; i < band_count_in; i++) {
605 double tolerance = 0.1;
609
610 CU_ASSERT(band_in != NULL);
611 CU_ASSERT(band_out != NULL);
612
615
616 CU_ASSERT_DOUBLE_EQUAL(stats_in->
min, stats_out->
min, fabs(stats_in->
min) * tolerance);
617 CU_ASSERT_DOUBLE_EQUAL(stats_in->
max, stats_out->
max, fabs(stats_in->
max) * tolerance);
618 CU_ASSERT_DOUBLE_EQUAL(stats_in->
mean, stats_out->
mean, fabs(stats_in->
mean) * tolerance);
619 }
620
623 GDALClose(hDS_in);
624}
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
rt_raster rt_raster_from_gdal_dataset(GDALDatasetH ds)
Return a raster from a GDAL dataset.
uint16_t rt_raster_get_num_bands(rt_raster raster)
rt_raster rt_raster_gdal_warp(rt_raster raster, const char *src_srs, const char *dst_srs, double *scale_x, double *scale_y, int *width, int *height, double *ul_xw, double *ul_yw, double *grid_xw, double *grid_yw, double *skew_x, double *skew_y, GDALResampleAlg resample_alg, double max_err)
Return a warped raster using GDAL Warp API.
rt_bandstats rt_band_get_summary_stats(rt_band band, int exclude_nodata_value, double sample, int inc_vals, uint64_t *cK, double *cM, double *cQ)
Compute summary statistics for a band.
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.