我有一些文本地址,我想通过api到Google Map询问其规格。最后,我要编写每个迭代,是指下面每个地址的规范,以将它们收集在一个表中。
数据由地址(街道,城镇,城市等)组成。
sonuc<-vector()
for (i in 1:length(asd)){
a<-geocode(asd[i],
output = c("all"), source = c("google"), urlonly = FALSE,
nameType = "long", ext = "com", inject = "")
geocodeadres<-(c(a$results[[i]]$formatted_address,
a$results[[i]]$address_components[[3]]$long_name,
a$results[[i]]$address_components[[2]]$long_name,
a$results[[i]]$address_components[[1]]$long_name,
a$results[[i]]$address_components[[7]]$long_name,
a$results[[i]]$address_components[[4]]$long_name,
a$results[[i]]$address_components[[5]]$long_name,
a$results[[i]]$geometry$location$lat,
a$results[[i]]$geometry$location$lng,
a$results[[i]]$geometry$location_type,
a$results[[i]]$partial_match,
a$results[[i]]$place_id,
a$results[[i]]$types[[1]],
a$status[i],
a$results[[i]]$address_components[[2]]$types[[1]]))
sonuc<-rbind(sonuc,geocodeadres)
}
print(sonuc)