当前位置:天才代写 > tutorial > 其他教程 > 用R语言读取经纬度的一个要领

用R语言读取经纬度的一个要领

2017-12-04 08:00 星期一 所属: 其他教程 浏览:427

依赖于google的一个处事,天天只能读取2500个,每个地点也没有google earth较准确,但可以作为参考。

require(RCurl)
require(XML)
require(rjson)

x1 = getURI(‘http://maps.googleapis.com/maps/api/geocode/json?address=Jiutian,+Taihu,+anhui+china&sensor=false’)
x2
=
getURI(‘http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false’)

y1 = fromJSON(x1)
y2 = xmlParse(x2)

y1$results[[1]]$geometry$location$lat
y1$results[[1]]$geometry$location$lng

xmlValue(getNodeSet(doc = y2, path = “//geometry//location//lat”)[[1]])
xmlValue(getNodeSet(doc = y2, path = “//geometry//location//lng”)[[1]])

 

    关键字:

天才代写-代写联系方式