PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ST_GeoHash()

Datum ST_GeoHash ( PG_FUNCTION_ARGS  )

Definition at line 2668 of file lwgeom_functions_basic.c.

2669 {
2670 
2671  GSERIALIZED *geom = NULL;
2672  int precision = 0;
2673  char *geohash = NULL;
2674  text *result = NULL;
2675 
2676  if ( PG_ARGISNULL(0) )
2677  {
2678  PG_RETURN_NULL();
2679  }
2680 
2681  geom = PG_GETARG_GSERIALIZED_P(0);
2682 
2683  if ( ! PG_ARGISNULL(1) )
2684  {
2685  precision = PG_GETARG_INT32(1);
2686  }
2687 
2689 
2690  if ( ! geohash )
2691  PG_RETURN_NULL();
2692 
2693  result = cstring_to_text(geohash);
2694  pfree(geohash);
2695 
2696  PG_RETURN_TEXT_P(result);
2697 }
static uint8_t precision
Definition: cu_in_twkb.c:25
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
char * lwgeom_geohash(const LWGEOM *lwgeom, int precision)
Calculate the GeoHash (http://geohash.org) string for a geometry.
Definition: lwalgorithm.c:856

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

Here is the call graph for this function: