PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ rt_raster_new()

rt_raster rt_raster_new ( uint32_t  width,
uint32_t  height 
)

Construct a raster with given dimensions.

Transform will be set to identity. Will contain no bands.

Parameters
width: number of pixel columns
height: number of pixel rows
Returns
an rt_raster or NULL if out of memory

Definition at line 48 of file rt_raster.c.

References rt_raster_t::bands, rt_raster_t::height, rt_raster_t::ipX, rt_raster_t::ipY, rt_raster_t::numBands, RASTER_DEBUGF, rt_raster_destroy(), rtalloc(), rterror(), rt_raster_t::scaleX, rt_raster_t::scaleY, rt_raster_t::skewX, rt_raster_t::skewY, rt_raster_t::srid, SRID_UNKNOWN, and rt_raster_t::width.

Referenced by convert_raster(), diff_rastinfo(), fillRasterToPolygonize(), RASTER_addBandOutDB(), RASTER_asRaster(), RASTER_clip(), RASTER_makeEmpty(), RASTER_mapAlgebra2(), RASTER_mapAlgebraExpr(), RASTER_mapAlgebraFct(), RASTER_mapAlgebraFctNgb(), RASTER_nMapAlgebra(), RASTER_nMapAlgebraExpr(), RASTER_tile(), rt_band_load_offline_data(), rt_raster_clone(), rt_raster_compute_skewed_raster(), rt_raster_from_band(), rt_raster_from_gdal_dataset(), rt_raster_from_two_rasters(), rt_raster_gdal_rasterize(), rt_raster_gdal_warp(), rt_raster_iterator(), test_band_get_nearest_pixel(), test_band_get_pixel_line(), test_band_get_pixel_of_value(), test_band_metadata(), test_band_reclass(), test_band_stats(), test_band_value_count(), test_gdal_to_raster(), test_gdal_warp(), test_pixel_set_to_array(), test_raster_cell_to_geopoint(), test_raster_clone(), test_raster_colormap(), test_raster_convex_hull(), test_raster_empty(), test_raster_envelope(), test_raster_envelope_geom(), test_raster_from_band(), test_raster_from_two_rasters(), test_raster_fully_within_distance(), test_raster_geopoint_to_cell(), test_raster_geos_contains(), test_raster_geos_contains_properly(), test_raster_geos_covered_by(), test_raster_geos_covers(), test_raster_geos_overlaps(), test_raster_geos_touches(), test_raster_intersects(), test_raster_iterator(), test_raster_metadata(), test_raster_new(), test_raster_perimeter(), test_raster_pixel_as_polygon(), test_raster_replace_band(), test_raster_same_alignment(), test_raster_surface(), test_raster_to_gdal(), and test_raster_within_distance().

48  {
49  rt_raster ret = NULL;
50 
51  ret = (rt_raster) rtalloc(sizeof (struct rt_raster_t));
52  if (!ret) {
53  rterror("rt_raster_new: Out of virtual memory creating an rt_raster");
54  return NULL;
55  }
56 
57  RASTER_DEBUGF(3, "Created rt_raster @ %p", ret);
58 
59  if (width > 65535 || height > 65535) {
60  rterror("rt_raster_new: Dimensions requested exceed the maximum (65535 x 65535) permitted for a raster");
61  rt_raster_destroy(ret);
62  return NULL;
63  }
64 
65  ret->width = width;
66  ret->height = height;
67  ret->scaleX = 1;
68  ret->scaleY = -1;
69  ret->ipX = 0.0;
70  ret->ipY = 0.0;
71  ret->skewX = 0.0;
72  ret->skewY = 0.0;
73  ret->srid = SRID_UNKNOWN;
74 
75  ret->numBands = 0;
76  ret->bands = NULL;
77 
78  return ret;
79 }
double skewY
Definition: librtcore.h:2298
int32_t srid
Definition: librtcore.h:2300
uint16_t numBands
Definition: librtcore.h:2290
struct rt_raster_t * rt_raster
Types definitions.
Definition: librtcore.h:145
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
Definition: rt_context.c:199
void * rtalloc(size_t size)
Wrappers used for managing memory.
Definition: rt_context.c:171
double ipY
Definition: librtcore.h:2296
uint16_t height
Definition: librtcore.h:2302
uint16_t width
Definition: librtcore.h:2301
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:187
double skewX
Definition: librtcore.h:2297
#define RASTER_DEBUGF(level, msg,...)
Definition: librtcore.h:299
rt_band * bands
Definition: librtcore.h:2303
double ipX
Definition: librtcore.h:2295
double scaleX
Definition: librtcore.h:2293
double scaleY
Definition: librtcore.h:2294
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_raster.c:82
Here is the call graph for this function: