304 {
309 uint32_t width = 100;
311 uint32_t height = 100;
312 char srs[] = "PROJCS[\"unnamed\",GEOGCS[\"unnamed ellipse\",DATUM[\"unknown\",SPHEROID[\"unnamed\",6370997,0]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]],PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",45],PARAMETER[\"longitude_of_center\",-100],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1],AUTHORITY[\"EPSG\",\"2163\"]]";
313
314 uint64_t gdalSize;
315 uint8_t *gdal = NULL;
316
318 CU_ASSERT(raster != NULL);
319
321 CU_ASSERT(band != NULL);
322
325
326 for (x = 0;
x < width;
x++) {
327 for (y = 0;
y < height;
y++) {
328 rt_band_set_pixel(band, x, y, (((
double) x * y) + (x + y) + (x + y * x)) / (x + y + 1), NULL);
329 }
330 }
331
333
334 CU_ASSERT(gdalSize);
335
336
337
338
339
340
341
342
343 if (gdal) CPLFree(gdal);
344
346
348 CU_ASSERT(raster != NULL);
349
351 CU_ASSERT(band != NULL);
352
355
356 for (x = 0;
x < width;
x++) {
357 for (y = 0;
y < height;
y++) {
359 }
360 }
361
362
364
366
367 CU_ASSERT(gdalSize);
368
369 if (gdal) CPLFree(gdal);
370
372 CU_ASSERT(gdal == NULL);
373
375}
void rt_raster_set_scale(rt_raster raster, double scaleX, double scaleY)
Set scale in projection units.
uint8_t * rt_raster_to_gdal(rt_raster raster, const char *srs, char *format, char **options, uint64_t *gdalsize)
Return formatted GDAL raster from raster.
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
int rt_band_check_is_nodata(rt_band band)
Returns TRUE if the band is only nodata values.
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel's value.
void rt_raster_set_offsets(rt_raster raster, double x, double y)
Set insertion points in projection units.
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
void cu_free_raster(rt_raster raster)