...
 
Commits (2)
......@@ -25,8 +25,6 @@ df = read.csv("data/original/190302_viviendas-turisticas-comunidad-valenciana_va
separate(num, c("num", "puerta"), extra = "merge", sep = ", ", remove = FALSE) %>%
mutate(nombre_es_raw = as.factor(toupper(nombre_es_raw)))
# Basic Record linkage.
record.linkage.names = function(names,
officialnames = calles_valencia$nombre_es) {
......@@ -43,15 +41,13 @@ record.linkage.names = function(names,
}
# df$nombre_es = record.linkage.names(df$nombre_es_raw)
df = df %>%
mutate(nombre_es = record.linkage.names(nombre_es_raw)) %>%
left_join(calles_valencia)
# Geocoding with Photon ---------------------------------------------------
# Build a new dataframe with desired information.
df2 = df %>%
select(Signatura, Municipio, tipovia_ca, nomoficial, num) %>%
mutate(full_address_ca = paste(tipovia_ca, nomoficial, num, Municipio,
......@@ -64,8 +60,7 @@ geocoded.df = photon::geocode(head(df2$full_address_ca), limit = 1,
# Combine geocoded dataframe with original one.
df.combined = geocoded.df %>%
select(location, lon, lat) %>%
right_join(df, by = c("location" = "Address2"))
df.combined = df2 %>%
left_join(geocoded.df, by = c("full_address_ca" = "location"))
write.csv(df.combined, file = "data/output/filename.csv")