0

I executed the geocode function which gave latitude and longitude measurements. The few informations I have are the objects name, their provinces, and the country, so I'm not sure about the exactitude of the coordinates.

I would like to know if there is a way with the geocode function to find the detailed address of the object I'm georeferencing from the informations I have?

library(dplyr)
library(tidyr)
library(tidyverse)
library(tidygeocoder)

data <- data %>% mutate(adresse = paste0(name, " ", province, " ", country, sep=""))
data_osm <- data %>% geocode(address = adresse, method = "osm", verbose = TRUE) 

Here below an illustration my input :

  name               province                     country
ITP BUMBU            KINSHASA                       CD
COLLEGE ABBE LOYA 1  KINSHASA                       CD
COLLEGE ADORATION    SUD-KIVU                       CD    
COLLEGE ADORA        SUD-KIVU                       CD

Here my output :

adresse                            lat   lon
BUMBU ITP KINSHASA CD             -4.37  15.3
COLLEGE ABBE LOYA 1 KINSHASA CD   -4.36  15.3
COLLEGE ADORATION SUD-KIVU CD     -4.09  29.1
COLLEGE ADORA SUD-KIVU CD         -2.54  28.9

Example output wanted :

adresse                            lat   lon      exact adresse 
BUMBU ITP KINSHASA CD             -4.37  15.3   J7QQ+C6J,Kinshasa,RDC 
COLLEGE ABBE LOYA 1 KINSHASA CD   -4.36  15.3 J7VV+HR3, Kinshasa, RDC
Coralie
  • 187
  • 8
  • 2
    [See here](https://stackoverflow.com/q/5963269/5325862) on making a reproducible example that is easier for folks to help with. That's going to include a sample of data—in this case a few addresses—and what packages you're using. Without data, we can't run your code, and you didn't include any output, so it's unclear what detail is lacking in what you're getting back after geocoding – camille Aug 27 '21 at 16:09
  • Thanks for your comments, I edited the question following your indications. – Coralie Aug 27 '21 at 16:25
  • 1
    What are the details you're trying to get though? You got the address and the coordinates—what's an example of what you're still missing? – camille Aug 27 '21 at 16:43
  • I would like to get the exact addresses ( I just edited an example on my question) or the county in which each are in order to do a back checking to make sure the coordinates are correct. – Coralie Aug 27 '21 at 16:50
  • 1
    Sounds like you're looking for "reverse geocoding" like in this tutorial: https://towardsdatascience.com/reverse-geocoding-in-r-f7fe4b908355 – Jon Spring Aug 27 '21 at 17:12
  • Also see these relevant prior questions, which reference other tutorials too: https://stackoverflow.com/questions/37117472/loop-for-reverse-geocoding-in-r and https://stackoverflow.com/questions/11280145/convert-lat-lon-to-zipcode-neighborhood-name/11353986#11353986 – Jon Spring Aug 27 '21 at 17:14

0 Answers0