I am reverse geocoding coordinates which pertain to addresses in countries where the Cyrillic alphabet is used. I am using tidygeocoder
and OSM/Nominatim
as a method. How can I modify my request in tidygeocoder
to get the results/addresses not in Cyrillic but in Latin letters/in English?
As far as I can tell, the relevant property in the Nominatim/OSM API is accept-language
(see here and here). But adding it to a tidygeocoder request seems not to work.
library(tidygeocoder)
library(tidyverse)
df_res <- tibble(
lat=41.992073,
long=21.429506
) %>%
reverse_geocode(.,
lat=lat,
long=long,
address="address",
method="osm")
The resulting address reads as
Шпаркасе, Македонија, Водно, Центар, Скопје, Општина Центар, Град Скопје, Скопски СР, 1111, Северна Македонија
Modifying the request to (as suggested here):
tibble(
lat=41.992073,
long=21.429506
) %>%
reverse_geocode(.,
lat=lat,
long=long,
address="address",
method="osm",
api_options = list(osm_accept_language="en")
)
leads to an error:
Error: Invalid parameter "osm_accept_language" used in the api_options argument. See ?reverse_geo
Any help? The error also occurs when using "osm_accept-language". Many thanks!
Thanks to a reply from the package author on github I found the answer:
df_res <- tibble(
lat=41.992073,
long=21.429506
) %>%
reverse_geocode(.,
lat=lat,
long=long,
address="address",
method="osm",
custom_query = list("accept-language"="en-US"))