geohash 得到块的区间坐标

一个geohash的 值是对应的一个地图区域的,然后我需要的这个区域的坐标区间 ,即经纬度的最大最小值。

那么在geohash 的wiki主页上找到c的实现,赞一个。

在我的机器上还不能直接编译通过,做了如下改变:

1 geohash.c 文件改成geohash.cpp

2 去掉 stdbool.h 这是C99 的头文件,vs2005 不支持,stdbool的全文如下,实现不行,就赋值内容到geohash.h文件中去

#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 bool
#define bool bool
#define false false
#define true 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 longtitude

printf("%lf %lf\n" ,area->latitude.max ,area->latitude.min);
printf("%lf %lf\n" ,area->longitude.max ,area->longitude.min);

参考:

1: http://en.wikipedia.org/wiki/Geohash

2: https://github.com/lyokato/libgeohash

原始博客地址: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/

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值