PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ test_geohash_precision()

static void test_geohash_precision ( void  )
static

Definition at line 923 of file cu_algorithm.c.

924{
925 GBOX bbox;
926 GBOX bounds;
927 int precision = 0;
928 gbox_init(&bbox);
929 gbox_init(&bounds);
930
931 bbox.xmin = 23.0;
932 bbox.xmax = 23.0;
933 bbox.ymin = 25.2;
934 bbox.ymax = 25.2;
935 precision = lwgeom_geohash_precision(bbox, &bounds);
936 //printf("\nprecision %d\n",precision);
937 CU_ASSERT_EQUAL(precision, 20);
938
939 bbox.xmin = 23.0;
940 bbox.ymin = 23.0;
941 bbox.xmax = 23.1;
942 bbox.ymax = 23.1;
943 precision = lwgeom_geohash_precision(bbox, &bounds);
944 //printf("precision %d\n",precision);
945 CU_ASSERT_EQUAL(precision, 3);
946
947 bbox.xmin = 23.0;
948 bbox.ymin = 23.0;
949 bbox.xmax = 23.0001;
950 bbox.ymax = 23.0001;
951 precision = lwgeom_geohash_precision(bbox, &bounds);
952 //printf("precision %d\n",precision);
953 CU_ASSERT_EQUAL(precision, 7);
954
955}
static uint8_t precision
Definition cu_in_twkb.c:25
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
Definition gbox.c:40
int lwgeom_geohash_precision(GBOX bbox, GBOX *bounds)
double ymax
Definition liblwgeom.h:357
double xmax
Definition liblwgeom.h:355
double ymin
Definition liblwgeom.h:356
double xmin
Definition liblwgeom.h:354

References gbox_init(), lwgeom_geohash_precision(), precision, GBOX::xmax, GBOX::xmin, GBOX::ymax, and GBOX::ymin.

Referenced by algorithms_suite_setup().

Here is the call graph for this function:
Here is the caller graph for this function: