[R] problem with accents and Catalan characters (for ex. ç) using geocode function (ggmap)

Marc Marí Dell'Olmo marceivissa at gmail.com
Mon Aug 24 10:43:07 CEST 2015


Dear all,

I'm trying to geocode addresses (of Catalonia) with accents and
Catalan characters (as for example "ç").  I'm using the "geocode"
function (package ggmap), but I obtain some Google "INVALID_REQUEST"
when the addresses have these characters. For example:

> geocode("Carrer Veneçuela, 10, 08019 Barcelona, Spain")
Information from URL :
http://maps.googleapis.com/maps/api/geocode/json?address=Carrer+Vene%E7uela,+10,+08019+Barcelona,+Spain&sensor=false
  lon lat
1  NA  NA
Warning message:
geocode failed with status INVALID_REQUEST, location =
"Carrer+Veneçuela,+10,+08019+Barcelona,+Spain"


> geocode("Carrer Mecànica, 12, 08038 Barcelona, Spain")
Information from URL :
http://maps.googleapis.com/maps/api/geocode/json?address=Carrer+Mec%E0nica,+12,+08038+Barcelona,+Spain&sensor=false
  lon lat
1  NA  NA
Warning message:
geocode failed with status INVALID_REQUEST, location =
"Carrer+Mecànica,+12,+08038+Barcelona,+Spain"

However, I can find these addresses directly on Google maps.

https://www.google.es/maps/place/Carrer+de+Vene%C3%A7uela,+10,+08019+Barcelona/@41.40873,2.2057253,17z/data=!3m1!4b1!4m2!3m1!1s0x12a4a347b9b9bb8d:0x41b696acd7b26e37

https://www.google.es/maps/place/Carrer+de+la+Mec%C3%A0nica,+12,+08038+Barcelona/@41.3591918,2.1379927,17z/data=!3m1!4b1!4m2!3m1!1s0x12a498a25156dc8b:0xc9ccfd74e54c503f


I think that there is a problem enconding the URL. I hope anyone can
help me! Thank you very much!


Marc



More information about the R-help mailing list