PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void test_geohash_precision ( void  )
static

Definition at line 702 of file cu_algorithm.c.

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

Referenced by algorithms_suite_setup().

703 {
704  GBOX bbox;
705  GBOX bounds;
706  int precision = 0;
707  gbox_init(&bbox);
708  gbox_init(&bounds);
709 
710  bbox.xmin = 23.0;
711  bbox.xmax = 23.0;
712  bbox.ymin = 25.2;
713  bbox.ymax = 25.2;
714  precision = lwgeom_geohash_precision(bbox, &bounds);
715  //printf("\nprecision %d\n",precision);
716  CU_ASSERT_EQUAL(precision, 20);
717 
718  bbox.xmin = 23.0;
719  bbox.ymin = 23.0;
720  bbox.xmax = 23.1;
721  bbox.ymax = 23.1;
722  precision = lwgeom_geohash_precision(bbox, &bounds);
723  //printf("precision %d\n",precision);
724  CU_ASSERT_EQUAL(precision, 3);
725 
726  bbox.xmin = 23.0;
727  bbox.ymin = 23.0;
728  bbox.xmax = 23.0001;
729  bbox.ymax = 23.0001;
730  precision = lwgeom_geohash_precision(bbox, &bounds);
731  //printf("precision %d\n",precision);
732  CU_ASSERT_EQUAL(precision, 7);
733 
734 }
double xmax
Definition: liblwgeom.h:249
double ymin
Definition: liblwgeom.h:250
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
Definition: g_box.c:34
double xmin
Definition: liblwgeom.h:248
int lwgeom_geohash_precision(GBOX bbox, GBOX *bounds)
Definition: lwalgorithm.c:743
double ymax
Definition: liblwgeom.h:251

Here is the call graph for this function:

Here is the caller graph for this function: