A geohash value corresponds to a map area, and then I need the coordinates of this area, that is, the maximum and minimum values of latitude and longitude.
On the Wiki homepage of geohash, find the implementation of C and like it.
On my machine, the compilation cannot be passed directly, but the following changes have been made:
1. Change the geohash. c file to geohash. cpp.
2. Remove stdbool. H. This is the header file of c99, which is not supported by vs2005. The full text of stdbool is as follows. If it is not implemented, assign the value to the geohash. h file.
# Ifndef _ stdbool_h
# DEFINE _ stdbool_h
# Ifndef _ cplusplus
# Define bool _ bool
# Define true 1
# Define false 0
# Else/* _ cplusplus */
/* Supporting <stdbool. h> in C ++ is a GCC extension .*/
# DEFINE _ bool
# Define bool
# Define False false
# Define true
# Endif/* _ cplusplus */
/* Signal that all the definitions are present .*/
# DEFINE _ bool_true_false_are_defined 1
# Endif/* stdbool. H */
GEOHASH_area *area;area = GEOHASH_decode("ws3x7");area->longitude.max;///* You can get the range of both latitude and longtitudeprintf("%lf %lf\n" ,area->latitude.max ,area->latitude.min);printf("%lf %lf\n" ,area->longitude.max ,area->longitude.min);
Refer:
1: http://en.wikipedia.org/wiki/Geohash
2: https://github.com/lyokato/libgeohash
Original blog address: http://www.fuxiang90.com/2012/10/geohash-%E5%BE%97%E5%88%B0%E5%9D%97%E7%9A%84%E5%8C%BA%E9%97%B4%E5%9D%90%E6%A0%87/