PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ parse_geohash()

static GBOX* parse_geohash ( char *  geohash,
int  precision 
)
static

Definition at line 47 of file lwgeom_in_geohash.c.

References box2d_from_geohash(), decode_geohash_bbox(), gbox_new(), geohash_lwpgerror(), gflags(), PG_FUNCTION_INFO_V1(), GBOX::xmax, GBOX::xmin, GBOX::ymax, and GBOX::ymin.

Referenced by box2d_from_geohash(), and point_from_geohash().

48 {
49  GBOX *box = NULL;
50  double lat[2], lon[2];
51 
52  POSTGIS_DEBUG(2, "parse_geohash called.");
53 
54  if (NULL == geohash)
55  {
56  geohash_lwpgerror("invalid GeoHash representation", 2);
57  }
58 
59  decode_geohash_bbox(geohash, lat, lon, precision);
60 
61  POSTGIS_DEBUGF(2, "ST_Box2dFromGeoHash sw: %.20f, %.20f", lon[0], lat[0]);
62  POSTGIS_DEBUGF(2, "ST_Box2dFromGeoHash ne: %.20f, %.20f", lon[1], lat[1]);
63 
64  box = gbox_new(gflags(0, 0, 1));
65 
66  box->xmin = lon[0];
67  box->ymin = lat[0];
68 
69  box->xmax = lon[1];
70  box->ymax = lat[1];
71 
72  POSTGIS_DEBUG(2, "parse_geohash finished.");
73  return box;
74 }
GBOX * gbox_new(uint8_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition: g_box.c:43
double xmax
Definition: liblwgeom.h:293
void decode_geohash_bbox(char *geohash, double *lat, double *lon, int precision)
Definition: lwalgorithm.c:704
double ymin
Definition: liblwgeom.h:294
double xmin
Definition: liblwgeom.h:292
static void geohash_lwpgerror(char *msg, int error_code)
uint8_t precision
Definition: cu_in_twkb.c:25
double ymax
Definition: liblwgeom.h:295
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:145
Here is the call graph for this function:
Here is the caller graph for this function: