PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ test_geohash_precision()

static void test_geohash_precision ( void  )
static

Definition at line 705 of file cu_algorithm.c.

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

Referenced by algorithms_suite_setup().

706 {
707  GBOX bbox;
708  GBOX bounds;
709  int precision = 0;
710  gbox_init(&bbox);
711  gbox_init(&bounds);
712 
713  bbox.xmin = 23.0;
714  bbox.xmax = 23.0;
715  bbox.ymin = 25.2;
716  bbox.ymax = 25.2;
717  precision = lwgeom_geohash_precision(bbox, &bounds);
718  //printf("\nprecision %d\n",precision);
719  CU_ASSERT_EQUAL(precision, 20);
720 
721  bbox.xmin = 23.0;
722  bbox.ymin = 23.0;
723  bbox.xmax = 23.1;
724  bbox.ymax = 23.1;
725  precision = lwgeom_geohash_precision(bbox, &bounds);
726  //printf("precision %d\n",precision);
727  CU_ASSERT_EQUAL(precision, 3);
728 
729  bbox.xmin = 23.0;
730  bbox.ymin = 23.0;
731  bbox.xmax = 23.0001;
732  bbox.ymax = 23.0001;
733  precision = lwgeom_geohash_precision(bbox, &bounds);
734  //printf("precision %d\n",precision);
735  CU_ASSERT_EQUAL(precision, 7);
736 
737 }
double xmax
Definition: liblwgeom.h:292
double ymin
Definition: liblwgeom.h:293
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
Definition: g_box.c:51
double xmin
Definition: liblwgeom.h:291
int lwgeom_geohash_precision(GBOX bbox, GBOX *bounds)
Definition: lwalgorithm.c:742
uint8_t precision
Definition: cu_in_twkb.c:25
double ymax
Definition: liblwgeom.h:294
Here is the call graph for this function:
Here is the caller graph for this function: