PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ ST_GeoHash()

Datum ST_GeoHash ( PG_FUNCTION_ARGS  )

Definition at line 2683 of file lwgeom_functions_basic.c.

2684{
2685
2686 GSERIALIZED *geom = NULL;
2687 int precision = 0;
2688 char *geohash = NULL;
2689 text *result = NULL;
2690
2691 if (PG_ARGISNULL(0))
2692 {
2693 PG_RETURN_NULL();
2694 }
2695
2696 geom = PG_GETARG_GSERIALIZED_P(0);
2697
2698 if (!PG_ARGISNULL(1))
2699 {
2700 precision = PG_GETARG_INT32(1);
2701 }
2702
2704
2705 if (!geohash)
2706 PG_RETURN_NULL();
2707
2708 result = cstring_to_text(geohash);
2709 pfree(geohash);
2710
2711 PG_RETURN_TEXT_P(result);
2712}
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.

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

Here is the call graph for this function: