1

I am writing a R script to crawl evelatio for a large number of GPS points, using XML and RCurl package. With the help of Google Map Elevation API, it's useful to get the evelation value. Here I notice that the maximum number of locations in a request is 512. The script works fine when there are like 100 GPS points in a requests. So I tried to get 512 elevation values at a request, as I have too many GPS poins.

However, the scrip returns an error saying

Failed to connect to maps.googleapis.com port 443: Timed out

And when I type the url of the request with 512 GPS locations in Chrome, there is also an error, saying

error 413 request entity too large

Did I misunderstand what Google says for the limit of this API? Or does anyone know whats the problem? And how to solve that?

Kai Xie
  • 117
  • 1
  • 2
  • 10
  • How are you building your request? – geocodezip Jun 13 '17 at 03:08
  • @geocodezip As mentioned on [this page](https://developers.google.com/maps/documentation/elevation/intro), this is my request – Kai Xie Jun 13 '17 at 07:17
  • And I just tried again and found that the max locations in a request is only 270 – Kai Xie Jun 13 '17 at 07:51
  • as you're using `r`, have you tried my `googleway` package, and the `google_elevation()` function? – SymbolixAU Jun 13 '17 at 21:47
  • Thank you for your suggestions. And good to know the package`googleway`. I fixed my problem by reducing the number of locations in a request to 250 and system pause if no data returned for a request. For guys who may encounter the same problem, even in the function `google_elevation`, you can not give 512 locations in one request. So be careful! @SymbolixAU – Kai Xie Jun 14 '17 at 15:13
  • @KaiXie - yes, I [found that out here](https://stackoverflow.com/q/42746432/5977215) - thanks for the warning. Also, if your points follow a path, you can encode them into a polyline, which will allow you to send more coordinates through at a time. – SymbolixAU Jun 14 '17 at 21:46
  • @SymbolixAU thank you bro. The `googleway` package is really helpful in terms of running speed, compared with mine. – Kai Xie Jun 15 '17 at 13:58

1 Answers1

2

Error fixed by reducing the number of locations in a request and setting system pause for request error. Though it costs some time, it's fine for my case. For guy who have millions of GPS points, I think it's still a problem...

Kai Xie
  • 117
  • 1
  • 2
  • 10