PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ ST_GeoHash()

Datum ST_GeoHash ( PG_FUNCTION_ARGS  )

Definition at line 2800 of file lwgeom_functions_basic.c.

2801 {
2802 
2803  GSERIALIZED *geom = NULL;
2804  int precision = 0;
2805  lwvarlena_t *geohash = NULL;
2806 
2807  if (PG_ARGISNULL(0))
2808  {
2809  PG_RETURN_NULL();
2810  }
2811 
2812  geom = PG_GETARG_GSERIALIZED_P(0);
2813 
2814  if (!PG_ARGISNULL(1))
2815  {
2816  precision = PG_GETARG_INT32(1);
2817  }
2818 
2819  geohash = lwgeom_geohash((LWGEOM *)(lwgeom_from_gserialized(geom)), precision);
2820  if (geohash)
2821  PG_RETURN_TEXT_P(geohash);
2822  PG_RETURN_NULL();
2823 }
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: