29 #include "utils/builtins.h"
31 #include "../postgis_config.h"
32 #include "lwgeom_pg.h"
41 POSTGIS_DEBUGF(3,
"ST_Box2dFromGeoHash ERROR %i", error_code);
50 double lat[2], lon[2];
52 POSTGIS_DEBUG(2,
"parse_geohash called.");
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]);
72 POSTGIS_DEBUG(2,
"parse_geohash finished.");
80 text *geohash_input = NULL;
94 geohash_input = PG_GETARG_TEXT_P(0);
95 geohash = text_to_cstring(geohash_input);
99 PG_RETURN_POINTER(box);
108 text *geohash_input = NULL;
109 char *geohash = NULL;
118 if (!PG_ARGISNULL(1))
123 geohash_input = PG_GETARG_TEXT_P(0);
124 geohash = text_to_cstring(geohash_input);
136 PG_RETURN_POINTER(
result);
char result[OUT_DOUBLE_BUFFER_SIZE]
GBOX * gbox_new(lwflags_t flags)
Create a new gbox with the dimensionality indicated by the flags.
LWPOINT * lwpoint_make2d(int32_t srid, double x, double y)
lwflags_t lwflags(int hasz, int hasm, int geodetic)
Construct a new flags bitmask.
#define SRID_UNKNOWN
Unknown SRID value.
This library is the generic geometry handling section of PostGIS.
void decode_geohash_bbox(char *geohash, double *lat, double *lon, int precision)
Datum box2d_from_geohash(PG_FUNCTION_ARGS)
static GBOX * parse_geohash(char *geohash, int precision)
PG_FUNCTION_INFO_V1(box2d_from_geohash)
static void geohash_lwpgerror(char *msg, __attribute__((__unused__)) int error_code)
Datum point_from_geohash(PG_FUNCTION_ARGS)