PostGIS  2.5.2dev-r@@SVN_REVISION@@

◆ test_raster_metadata()

static void test_raster_metadata ( )
static

Definition at line 62 of file cu_raster_basics.c.

References cu_free_raster(), rtrowdump::raster, rt_raster_get_num_bands(), rt_raster_get_srid(), rt_raster_get_x_offset(), rt_raster_get_x_scale(), rt_raster_get_x_skew(), rt_raster_get_y_offset(), rt_raster_get_y_scale(), rt_raster_get_y_skew(), rt_raster_has_band(), rt_raster_new(), rt_raster_set_offsets(), rt_raster_set_scale(), rt_raster_set_skews(), and rt_raster_set_srid().

Referenced by raster_basics_suite_setup().

62  {
63  rt_raster raster = NULL;
64 
65  /* create raster */
66  raster = rt_raster_new(5, 5);
67  CU_ASSERT(raster != NULL);
68 
69  /* # of bands */
70  CU_ASSERT_EQUAL(rt_raster_get_num_bands(raster), 0);
71 
72  /* has bands */
73  CU_ASSERT(!rt_raster_has_band(raster, 1));
74 
75  /* upper-left corner */
76  rt_raster_set_offsets(raster, 30, -70);
77  CU_ASSERT_DOUBLE_EQUAL(rt_raster_get_x_offset(raster), 30, DBL_EPSILON);
78  CU_ASSERT_DOUBLE_EQUAL(rt_raster_get_y_offset(raster), -70, DBL_EPSILON);
79 
80  /* scale */
81  rt_raster_set_scale(raster, 10, -10);
82  CU_ASSERT_DOUBLE_EQUAL(rt_raster_get_x_scale(raster), 10, DBL_EPSILON);
83  CU_ASSERT_DOUBLE_EQUAL(rt_raster_get_y_scale(raster), -10, DBL_EPSILON);
84 
85  /* skew */
86  rt_raster_set_skews(raster, 0.0001, -0.05);
87  CU_ASSERT_DOUBLE_EQUAL(rt_raster_get_x_skew(raster), 0.0001, DBL_EPSILON);
88  CU_ASSERT_DOUBLE_EQUAL(rt_raster_get_y_skew(raster), -0.05, DBL_EPSILON);
89 
90  /* srid */
91  rt_raster_set_srid(raster, 4326);
92  CU_ASSERT_EQUAL(rt_raster_get_srid(raster), 4326);
93  rt_raster_set_srid(raster, 4269);
94  CU_ASSERT_EQUAL(rt_raster_get_srid(raster), 4269);
95 
96  cu_free_raster(raster);
97 }
double rt_raster_get_x_offset(rt_raster raster)
Get raster x offset, in projection units.
Definition: rt_raster.c:213
double rt_raster_get_y_skew(rt_raster raster)
Get skew about the Y axis.
Definition: rt_raster.c:190
uint16_t rt_raster_get_num_bands(rt_raster raster)
Definition: rt_raster.c:372
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:121
void rt_raster_set_skews(rt_raster raster, double skewX, double skewY)
Set skews about the X and Y axis.
Definition: rt_raster.c:168
void cu_free_raster(rt_raster raster)
void rt_raster_set_scale(rt_raster raster, double scaleX, double scaleY)
Set scale in projection units.
Definition: rt_raster.c:137
void rt_raster_set_offsets(rt_raster raster, double x, double y)
Set insertion points in projection units.
Definition: rt_raster.c:199
double rt_raster_get_x_scale(rt_raster raster)
Get scale X in projection units.
Definition: rt_raster.c:150
int rt_raster_has_band(rt_raster raster, int nband)
Return TRUE if the raster has a band of this number.
Definition: rt_raster.c:1347
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster's SRID.
Definition: rt_raster.c:363
int32_t rt_raster_get_srid(rt_raster raster)
Get raster's SRID.
Definition: rt_raster.c:356
double rt_raster_get_y_scale(rt_raster raster)
Get scale Y in projection units.
Definition: rt_raster.c:159
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition: rt_raster.c:48
double rt_raster_get_x_skew(rt_raster raster)
Get skew about the X axis.
Definition: rt_raster.c:181
double rt_raster_get_y_offset(rt_raster raster)
Get raster y offset, in projection units.
Definition: rt_raster.c:222
Here is the call graph for this function:
Here is the caller graph for this function: