Get raster's convex hull.
The convex hull is a 4 vertices (5 to be closed) single ring polygon bearing the raster's rotation and using projection coordinates.
The convex hull is typically a 4 vertices (5 to be closed) single ring polygon bearing the raster's rotation and using projection coordinates.
838 {
839 double gt[6] = {0.0};
841
844
845 assert(hull != NULL);
846 *hull = NULL;
847
848
849 if (raster == NULL)
851
852
855
857
858
862
863
867 }
868
869 else {
872
873
875
876
878 raster,
881 gt
883 rterror(
"rt_raster_get_convex_hull: Could not get second point for linestring");
885 }
888
890 }
891
893 }
894 else {
897
898
900 if (!rings) {
901 rterror(
"rt_raster_get_convex_hull: Could not allocate memory for polygon ring");
903 }
905
906
907 if (!rings[0]) {
908 rterror(
"rt_raster_get_convex_hull: Could not construct point array");
910 }
911 pts = rings[0];
912
913
918
919
921 raster,
924 gt
925 );
927
928
930 raster,
933 gt
934 );
936
937
939 raster,
942 gt
943 );
945
948 }
949
951}
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
LWPOINT * lwpoint_make2d(int32_t srid, double x, double y)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
LWPOLY * lwpoly_construct(int32_t srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
#define LW_TRUE
Return types for functions with status returns.
#define SRID_UNKNOWN
Unknown SRID value.
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
LWGEOM * lwpoly_as_lwgeom(const LWPOLY *obj)
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...
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
rt_errorstate rt_raster_cell_to_geopoint(rt_raster raster, double xr, double yr, double *xw, double *yw, double *gt)
Convert an xr, yr raster point to an xw, yw point on map.
int32_t rt_raster_get_srid(rt_raster raster)
Get raster's SRID.
#define RASTER_DEBUGF(level, msg,...)
uint16_t rt_raster_get_height(rt_raster raster)
uint16_t rt_raster_get_width(rt_raster raster)
void rt_raster_get_geotransform_matrix(rt_raster raster, double *gt)
Get 6-element array of raster geotransform matrix.
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...