Calculate the GeoHash (http://geohash.org) string for a geometry.
Caller must free.
Definition at line 861 of file lwalgorithm.c.
862{
865 double lat, lon;
866 int result;
867
870
873
874
875 if ( gbox.
xmin < -180 || gbox.
ymin < -90 || gbox.
xmax > 180 || gbox.
ymax > 90 )
876 {
877 lwerror(
"Geohash requires inputs in decimal degrees, got (%g %g, %g %g).",
880 return NULL;
881 }
882
883
884
887
889 {
891 }
892
893
894
895
896
897
899}
int lwgeom_calculate_gbox_cartesian(const LWGEOM *lwgeom, GBOX *gbox)
Calculate the 2-4D bounding box of a geometry.
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
int lwgeom_geohash_precision(GBOX bbox, GBOX *bounds)
char * geohash_point(double longitude, double latitude, int precision)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
References gbox_init(), geohash_point(), LW_FAILURE, lwerror(), lwgeom_calculate_gbox_cartesian(), lwgeom_geohash_precision(), precision, GBOX::xmax, GBOX::xmin, GBOX::ymax, and GBOX::ymin.
Referenced by ST_GeoHash(), and test_geohash().