PostGIS  2.1.10dev-r@@SVN_REVISION@@
cu_raster_geometry.c
Go to the documentation of this file.
1 /*
2  * PostGIS Raster - Raster Types for PostGIS
3  * http://trac.osgeo.org/postgis/wiki/WKTRaster
4  *
5  * Copyright (C) 2012-2013 Regents of the University of California
6  * <bkpark@ucdavis.edu>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  */
23 
24 #include "CUnit/Basic.h"
25 #include "cu_tester.h"
26 
27 static void test_raster_convex_hull() {
28  rt_raster raster = NULL;
29  LWGEOM *hull = NULL;
30  LWPOLY *poly = NULL;
31  POINTARRAY *ring = NULL;
32  POINT4D pt;
33 
34  /* NULL raster */
35  CU_ASSERT_EQUAL(rt_raster_get_convex_hull(NULL, &hull), ES_NONE);
36  CU_ASSERT(hull == NULL);
37 
38  /* width = 0, height = 0 */
39  raster = rt_raster_new(0, 0);
40  CU_ASSERT(raster != NULL);
41 
42  CU_ASSERT_EQUAL(rt_raster_get_convex_hull(raster, &hull), ES_NONE);
43  CU_ASSERT_EQUAL(hull->type, POINTTYPE);
44  lwgeom_free(hull);
45  cu_free_raster(raster);
46 
47  /* width = 0 */
48  raster = rt_raster_new(0, 256);
49  CU_ASSERT(raster != NULL);
50 
51  CU_ASSERT_EQUAL(rt_raster_get_convex_hull(raster, &hull), ES_NONE);
52  CU_ASSERT_EQUAL(hull->type, LINETYPE);
53  lwgeom_free(hull);
54  cu_free_raster(raster);
55 
56  /* height = 0 */
57  raster = rt_raster_new(256, 0);
58  CU_ASSERT(raster != NULL);
59 
60  CU_ASSERT_EQUAL(rt_raster_get_convex_hull(raster, &hull), ES_NONE);
61  CU_ASSERT_EQUAL(hull->type, LINETYPE);
62  lwgeom_free(hull);
63  cu_free_raster(raster);
64 
65  /* normal raster */
66  raster = rt_raster_new(256, 256);
67  CU_ASSERT(raster != NULL);
68 
69  rt_raster_set_offsets(raster, 0.5, 0.5);
70  rt_raster_set_scale(raster, 1, 1);
71  rt_raster_set_skews(raster, 4, 5);
72 
73  CU_ASSERT_EQUAL(rt_raster_get_convex_hull(raster, &hull), ES_NONE);
74  poly = lwgeom_as_lwpoly(hull);
75  CU_ASSERT_EQUAL(poly->srid, rt_raster_get_srid(raster));
76  CU_ASSERT_EQUAL(poly->nrings, 1);
77 
78  ring = poly->rings[0];
79  CU_ASSERT(ring != NULL);
80  CU_ASSERT_EQUAL(ring->npoints, 5);
81 
82  getPoint4d_p(ring, 0, &pt);
83  CU_ASSERT_DOUBLE_EQUAL(pt.x, 0.5, DBL_EPSILON);
84  CU_ASSERT_DOUBLE_EQUAL(pt.y, 0.5, DBL_EPSILON);
85 
86  getPoint4d_p(ring, 1, &pt);
87  CU_ASSERT_DOUBLE_EQUAL(pt.x, 256.5, DBL_EPSILON);
88  CU_ASSERT_DOUBLE_EQUAL(pt.y, 1280.5, DBL_EPSILON);
89 
90  getPoint4d_p(ring, 2, &pt);
91  CU_ASSERT_DOUBLE_EQUAL(pt.x, 1280.5, DBL_EPSILON);
92  CU_ASSERT_DOUBLE_EQUAL(pt.y, 1536.5, DBL_EPSILON);
93 
94  getPoint4d_p(ring, 3, &pt);
95  CU_ASSERT_DOUBLE_EQUAL(pt.x, 1024.5, DBL_EPSILON);
96  CU_ASSERT_DOUBLE_EQUAL(pt.y, 256.5, DBL_EPSILON);
97 
98  getPoint4d_p(ring, 4, &pt);
99  CU_ASSERT_DOUBLE_EQUAL(pt.x, 0.5, DBL_EPSILON);
100  CU_ASSERT_DOUBLE_EQUAL(pt.y, 0.5, DBL_EPSILON);
101 
102  lwgeom_free(hull);
103  cu_free_raster(raster);
104 }
105 
106 static char *
107 lwgeom_to_text(const LWGEOM *lwgeom) {
108  char *wkt;
109  size_t wkt_size;
110 
111  wkt = lwgeom_to_wkt(lwgeom, WKT_ISO, DBL_DIG, &wkt_size);
112 
113  return wkt;
114 }
115 
116 static void test_raster_surface() {
117  rt_raster rast;
118  rt_band band;
119  const int maxX = 5;
120  const int maxY = 5;
121  int x, y;
122  char *wkt = NULL;
123  LWMPOLY *mpoly = NULL;
124  int err;
125 
126  rast = rt_raster_new(maxX, maxY);
127  CU_ASSERT(rast != NULL);
128 
129  rt_raster_set_offsets(rast, 0, 0);
130  rt_raster_set_scale(rast, 1, -1);
131 
132  band = cu_add_band(rast, PT_32BUI, 1, 0);
133  CU_ASSERT(band != NULL);
134 
135  for (y = 0; y < maxY; y++) {
136  for (x = 0; x < maxX; x++) {
137  rt_band_set_pixel(band, x, y, 1, NULL);
138  }
139  }
140 
141  err = rt_raster_surface(rast, 0, &mpoly);
142  CU_ASSERT_EQUAL(err, ES_NONE);
143  CU_ASSERT(mpoly != NULL);
144  wkt = lwgeom_to_text(lwmpoly_as_lwgeom(mpoly));
145  CU_ASSERT_STRING_EQUAL(wkt, "MULTIPOLYGON(((0 0,0 -5,5 -5,5 0,0 0)))");
146  rtdealloc(wkt);
147  lwmpoly_free(mpoly);
148  mpoly = NULL;
149 
150  /* 0,0 NODATA */
151  rt_band_set_pixel(band, 0, 0, 0, NULL);
152 
153  err = rt_raster_surface(rast, 0, &mpoly);
154  CU_ASSERT_EQUAL(err, ES_NONE);
155  CU_ASSERT(mpoly != NULL);
156  wkt = lwgeom_to_text(lwmpoly_as_lwgeom(mpoly));
157  CU_ASSERT_STRING_EQUAL(wkt, "MULTIPOLYGON(((1 0,1 -1,0 -1,0 -5,4 -5,5 -5,5 0,1 0)))");
158  rtdealloc(wkt);
159  lwmpoly_free(mpoly);
160  mpoly = NULL;
161 
162  /* plus 1,1 NODATA */
163  rt_band_set_pixel(band, 1, 1, 0, NULL);
164 
165  err = rt_raster_surface(rast, 0, &mpoly);
166  CU_ASSERT_EQUAL(err, ES_NONE);
167  CU_ASSERT(mpoly != NULL);
168  wkt = lwgeom_to_text(lwmpoly_as_lwgeom(mpoly));
169  CU_ASSERT_STRING_EQUAL(wkt, "MULTIPOLYGON(((1 0,1 -1,0 -1,0 -5,4 -5,5 -5,5 0,1 0),(1 -1,1 -2,2 -2,2 -1,1 -1)))");
170  rtdealloc(wkt);
171  lwmpoly_free(mpoly);
172  mpoly = NULL;
173 
174  /* plus 2,2 NODATA */
175  rt_band_set_pixel(band, 2, 2, 0, NULL);
176 
177  err = rt_raster_surface(rast, 0, &mpoly);
178  CU_ASSERT_EQUAL(err, ES_NONE);
179  CU_ASSERT(mpoly != NULL);
180  wkt = lwgeom_to_text(lwmpoly_as_lwgeom(mpoly));
181 #if POSTGIS_GEOS_VERSION >= 33
182  CU_ASSERT_STRING_EQUAL(wkt, "MULTIPOLYGON(((1 -1,1 0,5 0,5 -5,4 -5,0 -5,0 -1,1 -1),(1 -1,1 -2,2 -2,2 -1,1 -1),(2 -2,2 -3,3 -3,3 -2,2 -2)))");
183 #else
184  CU_ASSERT_STRING_EQUAL(wkt, "MULTIPOLYGON(((1 0,1 -1,0 -1,0 -5,4 -5,5 -5,5 0,1 0),(1 -1,1 -2,2 -2,2 -3,3 -3,3 -2,2 -2,2 -1,1 -1)))");
185 #endif
186  rtdealloc(wkt);
187  lwmpoly_free(mpoly);
188  mpoly = NULL;
189 
190  /* plus 3,3 NODATA */
191  rt_band_set_pixel(band, 3, 3, 0, NULL);
192 
193  err = rt_raster_surface(rast, 0, &mpoly);
194  CU_ASSERT_EQUAL(err, ES_NONE);
195  CU_ASSERT(mpoly != NULL);
196  wkt = lwgeom_to_text(lwmpoly_as_lwgeom(mpoly));
197 #if POSTGIS_GEOS_VERSION >= 33
198  CU_ASSERT_STRING_EQUAL(wkt, "MULTIPOLYGON(((1 -1,1 0,5 0,5 -5,4 -5,0 -5,0 -1,1 -1),(1 -1,1 -2,2 -2,2 -1,1 -1),(2 -2,2 -3,3 -3,3 -2,2 -2),(3 -3,3 -4,4 -4,4 -3,3 -3)))");
199 #else
200  CU_ASSERT_STRING_EQUAL(wkt, "MULTIPOLYGON(((1 0,1 -1,0 -1,0 -5,4 -5,5 -5,5 0,1 0),(1 -1,1 -2,2 -2,2 -3,3 -3,3 -4,4 -4,4 -3,3 -3,3 -2,2 -2,2 -1,1 -1)))");
201 #endif
202  rtdealloc(wkt);
203  lwmpoly_free(mpoly);
204  mpoly = NULL;
205 
206  /* plus 4,4 NODATA */
207  rt_band_set_pixel(band, 4, 4, 0, NULL);
208 
209  err = rt_raster_surface(rast, 0, &mpoly);
210  CU_ASSERT_EQUAL(err, ES_NONE);
211  CU_ASSERT(mpoly != NULL);
212  wkt = lwgeom_to_text(lwmpoly_as_lwgeom(mpoly));
213  CU_ASSERT_STRING_EQUAL(wkt, "MULTIPOLYGON(((4 -4,4 -5,0 -5,0 -1,1 -1,1 -2,2 -2,2 -3,3 -3,3 -4,4 -4)),((1 -1,1 0,5 0,5 -4,4 -4,4 -3,3 -3,3 -2,2 -2,2 -1,1 -1)))");
214  rtdealloc(wkt);
215  lwmpoly_free(mpoly);
216  mpoly = NULL;
217 
218  /* a whole lot more NODATA */
219  rt_band_set_pixel(band, 4, 0, 0, NULL);
220  rt_band_set_pixel(band, 3, 1, 0, NULL);
221  rt_band_set_pixel(band, 1, 3, 0, NULL);
222  rt_band_set_pixel(band, 0, 4, 0, NULL);
223 
224  err = rt_raster_surface(rast, 0, &mpoly);
225  CU_ASSERT_EQUAL(err, ES_NONE);
226  CU_ASSERT(mpoly != NULL);
227  wkt = lwgeom_to_text(lwmpoly_as_lwgeom(mpoly));
228  CU_ASSERT_STRING_EQUAL(wkt, "MULTIPOLYGON(((1 -4,2 -4,2 -3,3 -3,3 -4,4 -4,4 -5,3 -5,1 -5,1 -4)),((1 -4,0 -4,0 -1,1 -1,1 -2,2 -2,2 -3,1 -3,1 -4)),((3 -2,4 -2,4 -1,5 -1,5 -4,4 -4,4 -3,3 -3,3 -2)),((3 -2,2 -2,2 -1,1 -1,1 0,4 0,4 -1,3 -1,3 -2)))");
229  rtdealloc(wkt);
230  lwmpoly_free(mpoly);
231  mpoly = NULL;
232 
233  cu_free_raster(rast);
234 }
235 
236 static void test_raster_perimeter() {
237  rt_raster rast;
238  rt_band band;
239  const int maxX = 5;
240  const int maxY = 5;
241  int x, y;
242  char *wkt = NULL;
243  LWGEOM *geom = NULL;
244  int err;
245 
246  rast = rt_raster_new(maxX, maxY);
247  CU_ASSERT(rast != NULL);
248 
249  rt_raster_set_offsets(rast, 0, 0);
250  rt_raster_set_scale(rast, 1, -1);
251 
252  band = cu_add_band(rast, PT_32BUI, 1, 0);
253  CU_ASSERT(band != NULL);
254 
255  for (y = 0; y < maxY; y++) {
256  for (x = 0; x < maxX; x++) {
257  rt_band_set_pixel(band, x, y, 1, NULL);
258  }
259  }
260 
261  err = rt_raster_get_perimeter(rast, -1, &geom);
262  CU_ASSERT_EQUAL(err, ES_NONE);
263  CU_ASSERT(geom != NULL);
264  wkt = lwgeom_to_text(geom);
265  CU_ASSERT_STRING_EQUAL(wkt, "POLYGON((0 0,5 0,5 -5,0 -5,0 0))");
266  rtdealloc(wkt);
267  lwgeom_free(geom);
268  geom = NULL;
269 
270  /* row 0 is NODATA */
271  rt_band_set_pixel(band, 0, 0, 0, NULL);
272  rt_band_set_pixel(band, 1, 0, 0, NULL);
273  rt_band_set_pixel(band, 2, 0, 0, NULL);
274  rt_band_set_pixel(band, 3, 0, 0, NULL);
275  rt_band_set_pixel(band, 4, 0, 0, NULL);
276 
277  err = rt_raster_get_perimeter(rast, 0, &geom);
278  CU_ASSERT_EQUAL(err, ES_NONE);
279  CU_ASSERT(geom != NULL);
280  wkt = lwgeom_to_text(geom);
281  CU_ASSERT_STRING_EQUAL(wkt, "POLYGON((0 -1,5 -1,5 -5,0 -5,0 -1))");
282  rtdealloc(wkt);
283  lwgeom_free(geom);
284  geom = NULL;
285 
286  /* column 4 is NODATA */
287  /* pixel 4, 0 already set to NODATA */
288  rt_band_set_pixel(band, 4, 1, 0, NULL);
289  rt_band_set_pixel(band, 4, 2, 0, NULL);
290  rt_band_set_pixel(band, 4, 3, 0, NULL);
291  rt_band_set_pixel(band, 4, 4, 0, NULL);
292 
293  err = rt_raster_get_perimeter(rast, 0, &geom);
294  CU_ASSERT_EQUAL(err, ES_NONE);
295  CU_ASSERT(geom != NULL);
296  wkt = lwgeom_to_text(geom);
297  CU_ASSERT_STRING_EQUAL(wkt, "POLYGON((0 -1,4 -1,4 -5,0 -5,0 -1))");
298  rtdealloc(wkt);
299  lwgeom_free(geom);
300  geom = NULL;
301 
302  /* row 4 is NODATA */
303  rt_band_set_pixel(band, 0, 4, 0, NULL);
304  rt_band_set_pixel(band, 1, 4, 0, NULL);
305  rt_band_set_pixel(band, 2, 4, 0, NULL);
306  rt_band_set_pixel(band, 3, 4, 0, NULL);
307  /* pixel 4, 4 already set to NODATA */
308 
309  err = rt_raster_get_perimeter(rast, 0, &geom);
310  CU_ASSERT_EQUAL(err, ES_NONE);
311  CU_ASSERT(geom != NULL);
312  wkt = lwgeom_to_text(geom);
313  CU_ASSERT_STRING_EQUAL(wkt, "POLYGON((0 -1,4 -1,4 -4,0 -4,0 -1))");
314  rtdealloc(wkt);
315  lwgeom_free(geom);
316  geom = NULL;
317 
318  /* column 0 is NODATA */
319  /* pixel 0, 0 already set to NODATA*/
320  rt_band_set_pixel(band, 0, 1, 0, NULL);
321  rt_band_set_pixel(band, 0, 2, 0, NULL);
322  rt_band_set_pixel(band, 0, 3, 0, NULL);
323  /* pixel 0, 4 already set to NODATA*/
324 
325  err = rt_raster_get_perimeter(rast, 0, &geom);
326  CU_ASSERT_EQUAL(err, ES_NONE);
327  CU_ASSERT(geom != NULL);
328  wkt = lwgeom_to_text(geom);
329  CU_ASSERT_STRING_EQUAL(wkt, "POLYGON((1 -1,4 -1,4 -4,1 -4,1 -1))");
330  rtdealloc(wkt);
331  lwgeom_free(geom);
332  geom = NULL;
333 
334  /* columns 1 and 3 are NODATA */
335  /* pixel 1, 0 already set to NODATA */
336  rt_band_set_pixel(band, 1, 1, 0, NULL);
337  rt_band_set_pixel(band, 1, 2, 0, NULL);
338  rt_band_set_pixel(band, 1, 3, 0, NULL);
339  /* pixel 1, 4 already set to NODATA */
340  /* pixel 3, 0 already set to NODATA */
341  rt_band_set_pixel(band, 3, 1, 0, NULL);
342  rt_band_set_pixel(band, 3, 2, 0, NULL);
343  rt_band_set_pixel(band, 3, 3, 0, NULL);
344  /* pixel 3, 4 already set to NODATA */
345 
346  err = rt_raster_get_perimeter(rast, 0, &geom);
347  CU_ASSERT_EQUAL(err, ES_NONE);
348  CU_ASSERT(geom != NULL);
349  wkt = lwgeom_to_text(geom);
350  CU_ASSERT_STRING_EQUAL(wkt, "POLYGON((2 -1,3 -1,3 -4,2 -4,2 -1))");
351  rtdealloc(wkt);
352  lwgeom_free(geom);
353  geom = NULL;
354 
355  /* more pixels are NODATA */
356  rt_band_set_pixel(band, 2, 1, 0, NULL);
357  rt_band_set_pixel(band, 2, 3, 0, NULL);
358 
359  err = rt_raster_get_perimeter(rast, 0, &geom);
360  CU_ASSERT_EQUAL(err, ES_NONE);
361  CU_ASSERT(geom != NULL);
362  wkt = lwgeom_to_text(geom);
363  CU_ASSERT_STRING_EQUAL(wkt, "POLYGON((2 -2,3 -2,3 -3,2 -3,2 -2))");
364  rtdealloc(wkt);
365  lwgeom_free(geom);
366  geom = NULL;
367 
368  /* second band */
369  band = cu_add_band(rast, PT_32BUI, 1, 0);
370  CU_ASSERT(band != NULL);
371 
372  for (y = 0; y < maxY; y++) {
373  for (x = 0; x < maxX; x++) {
374  rt_band_set_pixel(band, x, y, 1, NULL);
375  }
376  }
377 
378  err = rt_raster_get_perimeter(rast, -1, &geom);
379  CU_ASSERT_EQUAL(err, ES_NONE);
380  CU_ASSERT(geom != NULL);
381  wkt = lwgeom_to_text(geom);
382  CU_ASSERT_STRING_EQUAL(wkt, "POLYGON((0 0,5 0,5 -5,0 -5,0 0))");
383  rtdealloc(wkt);
384  lwgeom_free(geom);
385  geom = NULL;
386 
387  cu_free_raster(rast);
388 }
389 
391  rt_raster rast;
392  rt_band band;
393  uint32_t x, y;
394  const int maxX = 10;
395  const int maxY = 10;
396  LWPOLY *poly = NULL;
397 
398  rast = rt_raster_new(maxX, maxY);
399  CU_ASSERT(rast != NULL);
400 
401  band = cu_add_band(rast, PT_32BUI, 1, 0);
402  CU_ASSERT(band != NULL);
403 
404  for (x = 0; x < maxX; x++) {
405  for (y = 0; y < maxY; y++) {
406  rt_band_set_pixel(band, x, y, 1, NULL);
407  }
408  }
409 
410  rt_band_set_pixel(band, 0, 0, 0, NULL);
411  rt_band_set_pixel(band, 3, 0, 0, NULL);
412  rt_band_set_pixel(band, 6, 0, 0, NULL);
413  rt_band_set_pixel(band, 9, 0, 0, NULL);
414  rt_band_set_pixel(band, 1, 2, 0, NULL);
415  rt_band_set_pixel(band, 4, 2, 0, NULL);
416  rt_band_set_pixel(band, 7, 2, 0, NULL);
417  rt_band_set_pixel(band, 2, 4, 0, NULL);
418  rt_band_set_pixel(band, 5, 4, 0, NULL);
419  rt_band_set_pixel(band, 8, 4, 0, NULL);
420  rt_band_set_pixel(band, 0, 6, 0, NULL);
421  rt_band_set_pixel(band, 3, 6, 0, NULL);
422  rt_band_set_pixel(band, 6, 6, 0, NULL);
423  rt_band_set_pixel(band, 9, 6, 0, NULL);
424  rt_band_set_pixel(band, 1, 8, 0, NULL);
425  rt_band_set_pixel(band, 4, 8, 0, NULL);
426  rt_band_set_pixel(band, 7, 8, 0, NULL);
427 
428  poly = rt_raster_pixel_as_polygon(rast, 1, 1);
429  CU_ASSERT(poly != NULL);
430  lwpoly_free(poly);
431 
432  cu_free_raster(rast);
433 }
434 
435 /* register tests */
436 void raster_geometry_suite_setup(void);
438 {
439  CU_pSuite suite = CU_add_suite("raster_geometry", NULL, NULL);
444 }
double x
Definition: liblwgeom.h:308
#define LINETYPE
Definition: liblwgeom.h:61
LWPOLY * rt_raster_pixel_as_polygon(rt_raster rast, int x, int y)
Get a raster pixel as a polygon.
Definition: rt_api.c:13182
void rtdealloc(void *mem)
Definition: rt_api.c:882
static void test_raster_surface()
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
Definition: lwout_wkt.c:655
int npoints
Definition: liblwgeom.h:327
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
tuple band
Definition: ovdump.py:57
tuple rast
Definition: rtpixdump.py:62
rt_errorstate rt_raster_get_perimeter(rt_raster raster, int nband, LWGEOM **perimeter)
Get raster perimeter.
Definition: rt_api.c:14683
tuple raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:123
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
Definition: lwgeom.c:125
int32_t rt_raster_get_srid(rt_raster raster)
Get raster's SRID.
Definition: rt_api.c:5661
void rt_raster_set_skews(rt_raster raster, double skewX, double skewY)
Set skews about the X and Y axis.
Definition: rt_api.c:5473
void cu_free_raster(rt_raster raster)
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
void lwmpoly_free(LWMPOLY *mpoly)
Definition: lwmpoly.c:40
static void test_raster_convex_hull()
void rt_raster_set_scale(rt_raster raster, double scaleX, double scaleY)
Set scale in projection units.
Definition: rt_api.c:5442
#define WKT_ISO
Definition: liblwgeom.h:1776
void lwpoly_free(LWPOLY *poly)
Definition: lwpoly.c:79
#define PG_ADD_TEST(suite, testfunc)
static void test_raster_pixel_as_polygon()
static void test_raster_perimeter()
POINTARRAY ** rings
Definition: liblwgeom.h:413
int nrings
Definition: liblwgeom.h:411
tuple x
Definition: pixval.py:53
int32_t srid
Definition: liblwgeom.h:410
rt_errorstate rt_raster_surface(rt_raster raster, int nband, LWMPOLY **surface)
Get a raster as a surface (multipolygon).
Definition: rt_api.c:13242
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
rt_errorstate rt_raster_get_convex_hull(rt_raster raster, LWGEOM **hull)
Get raster's convex hull.
Definition: rt_api.c:6556
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition: rt_api.c:5353
double y
Definition: liblwgeom.h:308
void raster_geometry_suite_setup(void)
static char * lwgeom_to_text(const LWGEOM *lwgeom)
LWGEOM * lwmpoly_as_lwgeom(const LWMPOLY *obj)
Definition: lwgeom.c:204
void rt_raster_set_offsets(rt_raster raster, double x, double y)
Set insertion points in projection units.
Definition: rt_api.c:5504
tuple y
Definition: pixval.py:54
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
Definition: lwgeom_api.c:217
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel's value.
Definition: rt_api.c:2302