PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ ST_GeoHash()

Datum ST_GeoHash ( PG_FUNCTION_ARGS  )

Definition at line 2917 of file lwgeom_functions_basic.c.

2918 {
2919 
2920  GSERIALIZED *geom = NULL;
2921  int precision = 0;
2922  lwvarlena_t *geohash = NULL;
2923 
2924  if (PG_ARGISNULL(0))
2925  {
2926  PG_RETURN_NULL();
2927  }
2928 
2929  geom = PG_GETARG_GSERIALIZED_P(0);
2930 
2931  if (!PG_ARGISNULL(1))
2932  {
2933  precision = PG_GETARG_INT32(1);
2934  }
2935 
2936  geohash = lwgeom_geohash((LWGEOM *)(lwgeom_from_gserialized(geom)), precision);
2937  if (geohash)
2938  PG_RETURN_TEXT_P(geohash);
2939  PG_RETURN_NULL();
2940 }
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:860

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

Here is the call graph for this function: