Get a raster pixel as a polygon.
The pixel shape is a 4 vertices (5 to be closed) single ring polygon bearing the raster's rotation and using projection coordinates
- Parameters
-
raster | : the raster to get pixel from |
x | : the column number |
y | : the row number |
- Returns
- the pixel polygon, or NULL on error.
Definition at line 610 of file rt_geometry.c.
612 double scale_x, scale_y;
613 double skew_x, skew_y;
620 assert(
rast != NULL);
633 p0.
x = scale_x *
x + skew_x *
y + ul_x;
634 p0.
y = scale_y *
y + skew_y *
x + ul_y;
637 p.
x = p0.
x + scale_x;
641 p.
x = p0.
x + scale_x + skew_x;
642 p.
y = p0.
y + scale_y + skew_y;
646 p.
y = p0.
y + scale_y;
POINTARRAY * ptarray_construct(char hasz, char hasm, uint32_t npoints)
Construct an empty pointarray, allocating storage and setting the npoints, but not filling in any inf...
LWPOLY * lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
void * rtalloc(size_t size)
Wrappers used for managing memory.
int32_t rt_raster_get_srid(rt_raster raster)
Get raster's SRID.
double rt_raster_get_x_skew(rt_raster raster)
Get skew about the X axis.
double rt_raster_get_x_offset(rt_raster raster)
Get raster x offset, in projection units.
double rt_raster_get_x_scale(rt_raster raster)
Get scale X in projection units.
double rt_raster_get_y_scale(rt_raster raster)
Get scale Y in projection units.
double rt_raster_get_y_skew(rt_raster raster)
Get skew about the Y axis.
double rt_raster_get_y_offset(rt_raster raster)
Get raster y offset, in projection units.
References lwpoly_construct(), ptarray_construct(), ptarray_set_point4d(), rtpixdump::rast, 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(), rtalloc(), POINT4D::x, pixval::x, POINT4D::y, and pixval::y.
Referenced by RASTER_getPixelPolygons(), RASTER_nearestValue(), and test_raster_pixel_as_polygon().