-
-
Save jurand71/8860f969c4057acdf408627ee641beb6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(ggmap) | |
library(readxl) | |
setwd('/Dane/IzPZ') | |
# wczytujemy dane | |
dane <- read_excel('instalacje_IPPC.xlsx', col_names = TRUE) | |
# | |
miejsca_df <- dane %>% | |
mutate(ADRES = paste0(NAZWA_ZAKLADU,', ',KOD ,' ',NAZWA_MIEJSCOWOSCI)) %>% | |
select(ADRES, NAZWA_WOJEWODZTWA, ULICA, NUMER, NUMER_BRANZY) | |
# miejsce na longitute and latitude | |
miejsca_df$long <- NA | |
miejsca_df$lat <- NA | |
#zdekodujemy z wykorzystaniem geolokalizatora google | |
ggmap::register_google(key='Sekretny_kod') | |
for(i in 1:nrow(miejsca_df)) { | |
loc <- geocode(paste0(iconv(miejsca_df[i, "ADRES"], to="UTF8"), ", Polska")) | |
miejsca_df[i, "long"] <- loc$lon | |
miejsca_df[i, "lat"] <- loc$lat | |
} | |
#zapisujemy do pliku | |
write.table(miejsca_df, file = "instalacje_IPPC.txt", row.names=FALSE, col.names=TRUE, fileEncoding="UTF-8") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment