30 #include "../postgis_config.h" 31 #include "lwgeom_pg.h" 40 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;
91 precision = PG_GETARG_INT32(1);
94 geohash_input = PG_GETARG_TEXT_P(0);
99 PG_RETURN_POINTER(box);
108 text *geohash_input = NULL;
109 char *geohash = NULL;
118 if (!PG_ARGISNULL(1))
120 precision = PG_GETARG_INT32(1);
123 geohash_input = PG_GETARG_TEXT_P(0);
136 PG_RETURN_POINTER(result);
GBOX * gbox_new(uint8_t flags)
Create a new gbox with the dimensionality indicated by the flags.
LWPOINT * lwpoint_make2d(int srid, double x, double y)
void decode_geohash_bbox(char *geohash, double *lat, double *lon, int precision)
Datum point_from_geohash(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(box2d_from_geohash)
static void geohash_lwpgerror(char *msg, int error_code)
#define SRID_UNKNOWN
Unknown SRID value.
char * text2cstring(const text *textptr)
Datum box2d_from_geohash(PG_FUNCTION_ARGS)
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
static GBOX * parse_geohash(char *geohash, int precision)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
This library is the generic geometry handling section of PostGIS.