I am web-scraping the Coordinates Data for some locations using wikipedia. I am following the steps outlined here: (note I changed the example on the hyperlink to match my work)
library(plyr)
library(dplyr)
library(xml2)
library(rvest)
library(magrittr)
library(geosphere)
location<-"Mendizorrotza"
#read HTML code from the website
webpage<-read_html(paste0("https://en.wikipedia.org/wiki/",location))
table <- webpage %>%
html_nodes("table.vcard") %>%
html_table(header=F)
table <- table[[1]]
#add the table to a dataframe
dict <- as.data.frame(table)
Within the coordinates row, it gives me three options:
42°50′13.60″N 2°41′16.96″W ;
42.8371111°N 2.6880444°W ;
42.8371111; -2.6880444
all on one line. I would like to find the distance between a pair of coordinates. Therefore, which one should I use to do so and how should I extract it? Also I never worked with coordinates before, which equation should I use to find my desired value?