Geocoder Client side vs server side

时间:2017-03-22 18:43:59

标签: javascript google-maps google-geocoder

I have one application in which there is a way to import address locations in to the system. This can be 10000 at a time.

Now after import, there is one tab for maps using which they can see their imported locations in to the map with marker. For this i used geocoder because i don't have the lat and lng for each location.But while in Map i am getting the geocoder query limit error.

I did search and found that there is a limit of 10 per request and 2500 per day in geocoder api. Now i am cofused that 1. If i use client side geocoder then in case of 3000 records to show on map at a time then how can i do that. 2. I found that we can do that using server side geocoder but that too has the limit of 2500 so what if some one is importing 10k records.

Please suggest me which method i should use.

And also need some more info about the limits too because i will have multiple users who will do the same.

Thanks.

1 个答案:

答案 0 :(得分:0)

最重要的是,Maps JavaScript API的客户端地理编码器并非设计用于批量地理编码。 documentation强调了这一事实:

  

注意:无论有多少用户共享同一个项目,服务请求都是每个用户会话的速率限制。首次加载服务API时,将为您分配初始请求配额。使用此配额后,API会按每秒对其他请求强制执行速率限制。如果在特定时间段内发出的请求太多,则API会返回OVER_QUERY_LIMIT响应代码。每会话速率限制可防止对批处理请求使用客户端服务。对于批量请求,请使用Maps API Web服务。

因此,如果您需要对数千个地址进行地理编码,则唯一可用的选项是服务器端地理编码。

服务器端地理编码每秒有50个查询限制,默认情况下每天有2500个请求。

https://developers.google.com/maps/documentation/geocoding/usage-limits

如果在项目中启用“结算”,则每天可以获得超过2500个请求。使用结算功能,您每天可以执行多达100K的请求,价格为0.50美元/ 1000个额外请求。