PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ test_geohash_precision()

static void test_geohash_precision ( void  )
static

Definition at line 784 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().

785 {
786  GBOX bbox;
787  GBOX bounds;
788  int precision = 0;
789  gbox_init(&bbox);
790  gbox_init(&bounds);
791 
792  bbox.xmin = 23.0;
793  bbox.xmax = 23.0;
794  bbox.ymin = 25.2;
795  bbox.ymax = 25.2;
796  precision = lwgeom_geohash_precision(bbox, &bounds);
797  //printf("\nprecision %d\n",precision);
798  CU_ASSERT_EQUAL(precision, 20);
799 
800  bbox.xmin = 23.0;
801  bbox.ymin = 23.0;
802  bbox.xmax = 23.1;
803  bbox.ymax = 23.1;
804  precision = lwgeom_geohash_precision(bbox, &bounds);
805  //printf("precision %d\n",precision);
806  CU_ASSERT_EQUAL(precision, 3);
807 
808  bbox.xmin = 23.0;
809  bbox.ymin = 23.0;
810  bbox.xmax = 23.0001;
811  bbox.ymax = 23.0001;
812  precision = lwgeom_geohash_precision(bbox, &bounds);
813  //printf("precision %d\n",precision);
814  CU_ASSERT_EQUAL(precision, 7);
815 
816 }
double xmax
Definition: liblwgeom.h:295
double ymin
Definition: liblwgeom.h:296
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
Definition: g_box.c:47
double xmin
Definition: liblwgeom.h:294
int lwgeom_geohash_precision(GBOX bbox, GBOX *bounds)
Definition: lwalgorithm.c:752
uint8_t precision
Definition: cu_in_twkb.c:25
double ymax
Definition: liblwgeom.h:297
Here is the call graph for this function:
Here is the caller graph for this function: