baidumap icon indicating copy to clipboard operation
baidumap copied to clipboard

getPlace errors

Open guyabel opened this issue 8 years ago • 4 comments

I am having trouble with the getPlace(). When I try the example code in the help file I get the following error...

> sh_mcdonald = getPlace('麦当劳', '上海')
Get records, Inf page. 
    Getting  0 th page 
Error in 1:total_page : result would be too long a vector

When I set pages = 10 I get an empty data frame.

> sh_mcdonald = getPlace('麦当劳', '上海', pages = 10)
Get records, 10 page. 
    Getting  0 th page 
    Getting  1 th page 
Done! 
> sh_mcdonald 
[1] lat lon
<0 rows> (or 0-length row.names)

Any ideas what I can do to get this working?

n.b. I think I managed to apply for the key correctly (I don't speak Chinese, so not 100% sure),... downloading a map works fine e.g. p <- getBaiduMap(c(116.354431, lat=39.942333)) once I set my key using options(baidumap.key = 'i_put_my_key_here')

guyabel avatar Oct 12 '17 07:10 guyabel

You may run out of your quota. Come here and check it: http://lbsyun.baidu.com/apiconsole/quota

badbye avatar Oct 12 '17 10:10 badbye

Thanks for the reply... I think they are all at 0% used?

untitled

guyabel avatar Oct 12 '17 10:10 guyabel

Just check the "Place API v2" (BTW, it is not real time). According to your screenshot, you can only call the API 2000 times every day. When running the "getPlace" function, each page(in the log) is counted as one call. The "getPlace" function usually return 20 pages, so run "getPlace" 100 times will spend all your quota.

badbye avatar Oct 13 '17 02:10 badbye

Defiantly run getPlace() less than 100 times... and the usage is still 0% this morning. Been playing around directly with API and I seem to get this message when using some their examples....

untitled

which as far as I can understand is saying my AK is not recognized (which might explain the 0% usage)... but I have copied and pasted the AK directly from the page where my keys are...

untitled2

... I was not too sure what I was doing when setting up the keys (I never really stray outside of R and google translate does not always make sense). Does anything look odd? What type of application should I be setting up?

guyabel avatar Oct 13 '17 04:10 guyabel