Hi,
I'm trying to do reversegeocoding on a large dataset. I'm using "RJSONIO"
library and using Google map API to get the location of the given lat-lon
in the dataset. After 100 or 150 successful displaying location information
it is showing
 Warning message - "In readLines(con) : cannot open: HTTP status was '0
(null)'"
and Error : "Error in fromJSON(paste(readLines(con), collapse = "")) :
  error in evaluating the argument 'content' in selecting a method for
function 'fromJSON': Error in readLines(con) : cannot open the connection"

Please help me to solve the issue.

location function is as follows :

location<-function(latlng){
 latlngStr <-  gsub(' ','%20', paste(latlng, collapse=","))
  library("RJSONIO") #Load Library
  #Open Connection
  connectStr <- paste('
http://maps.google.com/maps/api/geocode/json?sensor=false&latlng=',latlngStr,
sep="")
  con <- url(connectStr)
  data.json <- fromJSON(paste(readLines(con), collapse=""))
  close(con)

  data.json <- unlist(data.json)
  if(data.json["status"]=="OK")
    address <- data.json["results.formatted_address"]
  print (address)
}

I'm using R version 3.2.1 and Ubuntu 14.10 OS.

Thank you.



-- 

Shreya Ghosh

*9007448845*

-- The mind is not a vessel to be filled, but a fire to be kindled

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to