<?php
require_once(‘geohash.class.php‘);
$geo=new Geohash;
$gps=array();
for($i=0;$i<=100;$i++){
$g=array((rand(1000000,1001000)/100000),(rand(2000000,2001000)/100000));
$gps[]=$g;
}
foreach ($gps as $k => $v) {
echo $encode=$geo->encode($v[0],$v[1]);
echo "<br>";
print_r($decode=$geo->decode($encode));
echo "<br>"."<hr>";
}
geohash算法生成点
原文:http://my.oschina.net/acitiviti/blog/521304