2684{
2685
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 {
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}
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.