对一批地址进行减速地理编码 [英] Slow down Geocoding a batch of Address

查看:92
本文介绍了对一批地址进行减速地理编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算使用Google Maps V3 API对存储在数组中的一批地址进行地理编码。这些地址将从我的数据库中检索并进行地理编码,以便我们可以在地图上为它们创建标记。

I'm planning to use the Google Maps V3 API to geocode a batch of address stored in an array. These address will be retrieved from my database and geocoded so I can create markers for them on the map.

然而,我知道Google对地理编码速率设置了限制发送给他们的请求,所以我想知道我如何使用PHP来限制地理编码请求的速度,也许每隔10秒地理编码一次?

However I understand that Google has placed a limit on the rate of geocoding requests sent to them, so I am wondering how I can use PHP to limit the rate of geocoding requests, to maybe 1 geocode every 10 seconds?

sleep(10);

推荐答案

c $ c> sleep(10)会做到这一点。

Yep, sleep(10) would do that.

或者,在客户机上运行使用javascript的地理编码。速率限制基于IP地址,因此您可以通过浏览器进行地理编码将其传播给访问者。

Alternatively, run the geocoding using javascript on the client machine. The rate limiting is based on the IP address, so you can spread this out over your visitors by having their browser do the geocode.

这篇关于对一批地址进行减速地理编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆