PostGIS  2.2.7dev-r@@SVN_REVISION@@
static GBOX* parse_geohash ( char *  geohash,
int  precision 
)
static

Definition at line 32 of file lwgeom_in_geohash.c.

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

Referenced by box2d_from_geohash(), and point_from_geohash().

33 {
34  GBOX *box = NULL;
35  double lat[2], lon[2];
36 
37  POSTGIS_DEBUG(2, "parse_geohash called.");
38 
39  if (NULL == geohash)
40  {
41  geohash_lwpgerror("invalid GeoHash representation", 2);
42  }
43 
44  decode_geohash_bbox(geohash, lat, lon, precision);
45 
46  POSTGIS_DEBUGF(2, "ST_Box2dFromGeoHash sw: %.20f, %.20f", lon[0], lat[0]);
47  POSTGIS_DEBUGF(2, "ST_Box2dFromGeoHash ne: %.20f, %.20f", lon[1], lat[1]);
48 
49  box = gbox_new(gflags(0, 0, 1));
50 
51  box->xmin = lon[0];
52  box->ymin = lat[0];
53 
54  box->xmax = lon[1];
55  box->ymax = lat[1];
56 
57  POSTGIS_DEBUG(2, "parse_geohash finished.");
58  return box;
59 }
GBOX * gbox_new(uint8_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition: g_box.c:28
double xmax
Definition: liblwgeom.h:277
void decode_geohash_bbox(char *geohash, double *lat, double *lon, int precision)
Definition: lwalgorithm.c:689
double ymin
Definition: liblwgeom.h:278
double xmin
Definition: liblwgeom.h:276
static void geohash_lwpgerror(char *msg, int error_code)
uint8_t precision
Definition: cu_in_twkb.c:25
double ymax
Definition: liblwgeom.h:279
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:130

Here is the call graph for this function:

Here is the caller graph for this function: