使用 r 中的选择器小工具从地图对象获取经纬度

Get latitude and longitude from map object using selector gadget in r

我正在通过使用 chrome 的 selectorGadget 扩展在 R 中(第一次)进行数据抓取,它使用 包 "rvest" this 是我正在做的参考

我正在尝试从 this 网站获取数据

这是我的代码

#Specifying the url for desired website to be scrapped
url <- 'http://www.magicbricks.com/property-for-sale/Multistorey-Apartment-real-estate-Mumbai'

#Reading the HTML code from the website
webpage <- read_html(url)

map_data_html <- html_nodes(webpage,'.iconMap .stop-propagation')
map <- html_text(map_data_html)
head(map)

但这只给我文本 "map" ,我想访问这张地图内的纬度和经度属性。有什么建议吗?

可能不是最优的,但这是获得 lat/lon 值的一种方法:

map_data_html <- html_nodes(webpage,'.iconMap .stop-propagation')
map = html_attr(map_data_html,"data-link") # get the data-link part

lat = as.numeric(str_match(map, "lat=(.*?)&longt")[,2]) # find the lat
lon = as.numeric(str_match(map, "longt=(.*?)&projectOr")[,2]) # find the lon