I have a list of some districts in the city of Tehran which are saved in Persian in a CSV file. My first goal is to find these districts lat-lon. In order to load them correctly, I should set the system's locale to "Persian"
Sys.setlocale(locale = "persian")
but, I have found that when I try to use them as arguments in functions like geocode()
from ggmap
library, it doesn't work!
>geocode(c[1])
Information from URL : http://maps.googleapis.com/maps/api/geocode/json?
address=%C2%CC%E6%CF%C7%E4%ED%E5&sensor=false
lon lat
1 NA NA
Warning messages:
1: In readLines(connect, warn = FALSE) :
cannot open URL 'http://maps.googleapis.com/maps/api/geocode/json?
address=%C2%CC%E6%CF%C7%E4%ED%E5&sensor=false': HTTP status was '400 Bad
Request'
2: In geocode(c[1]) : geocoding failed for "آجودانيه".
if accompanied by 500 Internal Server Error with using dsk, try google.
here c
is my vector of Persian districts.
on the other hand, when I change system locale to English and type the district in Persian in geocode(), it works correctly.
>geocode("آجودانیه")
Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=%D8%A2%D8%AC%D9%88%D8%AF%D8%A7%D9%86%DB%8C%D9%87&sensor=false
lon lat
1 51.4861 35.80742
how can I find these districts lat-lon?
as a summary, when system locale is in Persian I receive NAs and when I return locale to English it works correctly.