PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ ST_GeoHash()

Datum ST_GeoHash ( PG_FUNCTION_ARGS  )

Definition at line 2688 of file lwgeom_functions_basic.c.

2689 {
2690 
2691  GSERIALIZED *geom = NULL;
2692  int precision = 0;
2693  lwvarlena_t *geohash = NULL;
2694 
2695  if (PG_ARGISNULL(0))
2696  {
2697  PG_RETURN_NULL();
2698  }
2699 
2700  geom = PG_GETARG_GSERIALIZED_P(0);
2701 
2702  if (!PG_ARGISNULL(1))
2703  {
2704  precision = PG_GETARG_INT32(1);
2705  }
2706 
2707  geohash = lwgeom_geohash((LWGEOM *)(lwgeom_from_gserialized(geom)), precision);
2708  if (geohash)
2709  PG_RETURN_TEXT_P(geohash);
2710  PG_RETURN_NULL();
2711 }
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: