PostGIS  3.4.0dev-r@@SVN_REVISION@@
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages

◆ test_raster_get_pixel_bilinear()

static void test_raster_get_pixel_bilinear ( )
static

Definition at line 579 of file cu_raster_geometry.c.

579  {
580  uint32_t width = 2;
581  uint32_t height = 2;
582  double ul_x = 0.0;
583  double ul_y = 0.0;
584  double scale_x = 1;
585  double scale_y = 1;
586  int err;
587 
588  double xr, yr;
589  double igt[6];
590 
591  rt_raster rast = rt_raster_new(width, height);
592  rt_raster_set_offsets(rast, ul_x, ul_y);
593  rt_raster_set_scale(rast, scale_x, scale_y);
594 
595  double xw = 1.5, yw = 0.5;
596 
598  rast, // rt_raster raster,
599  PT_64BF, // rt_pixtype pixtype,
600  1.0, // double initialvalue,
601  1, // uint32_t hasnodata,
602  -99.0, // double nodatavalue,
603  0 // int index
604  );
605 
607  rast,
608  xw, yw,
609  &xr, &yr, igt);
610 
611  printf("xw = %g, yw = %g, xr = %g, yr = %g\n", xw, yw, xr, yr);
612 
613  // err = rt_raster_cell_to_geopoint(
614  // rast,
615  // xr, yr,
616  // &xw, &yw, igt);
617 
618  // printf("xw = %g, yw = %g, xr = %g, yr = %g\n", xw, yw, xr, yr);
619 
621  rt_band_set_pixel(band, 0, 0, 10.0, NULL);
622  rt_band_set_pixel(band, 0, 1, 10.0, NULL);
623  rt_band_set_pixel(band, 1, 0, 20.0, NULL);
624  rt_band_set_pixel(band, 1, 1, 40.0, NULL);
625 
626 
627  double value = 0.0;
628  int nodata = 0;
630  band,
631  xw, yw, // double xw, double yw,
632  &value, &nodata // double *r_value, int *r_nodata)
633  );
634 
635  CU_ASSERT_EQUAL(err, ES_NONE);
636  printf("xw = %g, yw = %g, value = %g, nodata = %d\n", xr, yr, value, nodata);
637 
638 
639 }
int rt_raster_generate_new_band(rt_raster raster, rt_pixtype pixtype, double initialvalue, uint32_t hasnodata, double nodatavalue, int index)
Generate a new inline band and add it to a raster.
Definition: rt_raster.c:489
void rt_raster_set_scale(rt_raster raster, double scaleX, double scaleY)
Set scale in projection units.
Definition: rt_raster.c:141
@ PT_64BF
Definition: librtcore.h:198
rt_errorstate rt_raster_geopoint_to_rasterpoint(rt_raster raster, double xw, double yw, double *xr, double *yr, double *igt)
Convert an xw,yw map point to a xr,yr raster point.
Definition: rt_raster.c:852
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition: rt_raster.c:52
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel's value.
Definition: rt_band.c:974
@ ES_NONE
Definition: librtcore.h:182
rt_errorstate rt_band_get_pixel_bilinear(rt_band band, double xr, double yr, double *r_value, int *r_nodata)
Retrieve a point value from the raster using a world coordinate and bilinear interpolation.
Definition: rt_band.c:1260
void rt_raster_set_offsets(rt_raster raster, double x, double y)
Set insertion points in projection units.
Definition: rt_raster.c:203
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
Definition: rt_raster.c:385
int value
Definition: genraster.py:62
band
Definition: ovdump.py:58

References ovdump::band, ES_NONE, PT_64BF, rtpixdump::rast, rt_band_get_pixel_bilinear(), rt_band_set_pixel(), rt_raster_generate_new_band(), rt_raster_geopoint_to_rasterpoint(), rt_raster_get_band(), rt_raster_new(), rt_raster_set_offsets(), rt_raster_set_scale(), and genraster::value.

Referenced by raster_geometry_suite_setup().

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