PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ parse_geohash()

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

Definition at line 48 of file lwgeom_in_geohash.c.

49{
50 GBOX *box = NULL;
51 double lat[2], lon[2];
52
53 POSTGIS_DEBUG(2, "parse_geohash called.");
54
55 if (NULL == geohash)
56 {
57 geohash_lwpgerror("invalid GeoHash representation", 2);
58 }
59
60 decode_geohash_bbox(geohash, lat, lon, precision);
61
62 POSTGIS_DEBUGF(2, "ST_Box2dFromGeoHash sw: %.20f, %.20f", lon[0], lat[0]);
63 POSTGIS_DEBUGF(2, "ST_Box2dFromGeoHash ne: %.20f, %.20f", lon[1], lat[1]);
64
65 box = gbox_new(lwflags(0, 0, 1));
66
67 box->xmin = lon[0];
68 box->ymin = lat[0];
69
70 box->xmax = lon[1];
71 box->ymax = lat[1];
72
73 POSTGIS_DEBUG(2, "parse_geohash finished.");
74 return box;
75}
static uint8_t precision
Definition cu_in_twkb.c:25
GBOX * gbox_new(lwflags_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition gbox.c:32
lwflags_t lwflags(int hasz, int hasm, int geodetic)
Construct a new flags bitmask.
Definition lwutil.c:471
void decode_geohash_bbox(char *geohash, double *lat, double *lon, int precision)
static void geohash_lwpgerror(char *msg, __attribute__((__unused__)) int error_code)
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 decode_geohash_bbox(), gbox_new(), geohash_lwpgerror(), lwflags(), precision, GBOX::xmax, GBOX::xmin, GBOX::ymax, and GBOX::ymin.

Referenced by box2d_from_geohash(), and point_from_geohash().

Here is the call graph for this function:
Here is the caller graph for this function: