PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ test_geohash_precision()

static void test_geohash_precision ( void  )
static

Definition at line 918 of file cu_algorithm.c.

919 {
920  GBOX bbox;
921  GBOX bounds;
922  int precision = 0;
923  gbox_init(&bbox);
924  gbox_init(&bounds);
925 
926  bbox.xmin = 23.0;
927  bbox.xmax = 23.0;
928  bbox.ymin = 25.2;
929  bbox.ymax = 25.2;
930  precision = lwgeom_geohash_precision(bbox, &bounds);
931  //printf("\nprecision %d\n",precision);
932  CU_ASSERT_EQUAL(precision, 20);
933 
934  bbox.xmin = 23.0;
935  bbox.ymin = 23.0;
936  bbox.xmax = 23.1;
937  bbox.ymax = 23.1;
938  precision = lwgeom_geohash_precision(bbox, &bounds);
939  //printf("precision %d\n",precision);
940  CU_ASSERT_EQUAL(precision, 3);
941 
942  bbox.xmin = 23.0;
943  bbox.ymin = 23.0;
944  bbox.xmax = 23.0001;
945  bbox.ymax = 23.0001;
946  precision = lwgeom_geohash_precision(bbox, &bounds);
947  //printf("precision %d\n",precision);
948  CU_ASSERT_EQUAL(precision, 7);
949 
950 }
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)
Definition: lwalgorithm.c:765
double ymax
Definition: liblwgeom.h:343
double xmax
Definition: liblwgeom.h:341
double ymin
Definition: liblwgeom.h:342
double xmin
Definition: liblwgeom.h:340

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: