PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ ST_GeoHash()

Datum ST_GeoHash ( PG_FUNCTION_ARGS  )

Definition at line 2882 of file lwgeom_functions_basic.c.

2883 {
2884 
2885  GSERIALIZED *geom = NULL;
2886  int precision = 0;
2887  lwvarlena_t *geohash = NULL;
2888 
2889  if (PG_ARGISNULL(0))
2890  {
2891  PG_RETURN_NULL();
2892  }
2893 
2894  geom = PG_GETARG_GSERIALIZED_P(0);
2895 
2896  if (!PG_ARGISNULL(1))
2897  {
2898  precision = PG_GETARG_INT32(1);
2899  }
2900 
2901  geohash = lwgeom_geohash((LWGEOM *)(lwgeom_from_gserialized(geom)), precision);
2902  if (geohash)
2903  PG_RETURN_TEXT_P(geohash);
2904  PG_RETURN_NULL();
2905 }
static uint8_t precision
Definition: cu_in_twkb.c:25
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:268
lwvarlena_t * lwgeom_geohash(const LWGEOM *lwgeom, int precision)
Calculate the GeoHash (http://geohash.org) string for a geometry.
Definition: lwalgorithm.c:868

References lwgeom_from_gserialized(), lwgeom_geohash(), and precision.

Here is the call graph for this function: