File: geohash_sample.c

package info (click to toggle)
python-geohash 0.8.3-1.1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 160 kB
  • ctags: 132
  • sloc: python: 866; cpp: 715; makefile: 44; ansic: 17
file content (18 lines) | stat: -rw-r--r-- 385 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
#include "geohash.h"

int main(int argc,char* argv[]){
	char r[20];
	double lat,lon;
	int res;
	if((res=geohash_encode(35.0, 135.0, r, 20))==GEOHASH_OK){
		printf("%s\n",r);
	}else{
		printf("error with %d\n",res);
	}
	if((res=geohash_decode(r,23,&lat,&lon))==GEOHASH_OK){
		printf("%f %f\n",lat,lon);
	}else{
		printf("error with %d\n",res);
	}
}