PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ ST_GeoHash()

Datum ST_GeoHash ( PG_FUNCTION_ARGS  )

Definition at line 2798 of file lwgeom_functions_basic.c.

2799 {
2800 
2801  GSERIALIZED *geom = NULL;
2802  int precision = 0;
2803  lwvarlena_t *geohash = NULL;
2804 
2805  if (PG_ARGISNULL(0))
2806  {
2807  PG_RETURN_NULL();
2808  }
2809 
2810  geom = PG_GETARG_GSERIALIZED_P(0);
2811 
2812  if (!PG_ARGISNULL(1))
2813  {
2814  precision = PG_GETARG_INT32(1);
2815  }
2816 
2817  geohash = lwgeom_geohash((LWGEOM *)(lwgeom_from_gserialized(geom)), precision);
2818  if (geohash)
2819  PG_RETURN_TEXT_P(geohash);
2820  PG_RETURN_NULL();
2821 }
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:239
lwvarlena_t * lwgeom_geohash(const LWGEOM *lwgeom, int precision)
Calculate the GeoHash (http://geohash.org) string for a geometry.
Definition: lwalgorithm.c:863

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

Here is the call graph for this function: