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

Shaun Walbridge SWalbridge at esri.com
Mon Aug 24 16:49:13 CEST 2015


Try forcing the character encoding to UTF-8:

  geocode(enc2utf8("Carrer Veneçuela, 10, 08019 Barcelona, Spain"))


Note that at version 2.5, you also need to specify source="google".

P.S. Please don't cross-post your question to multiple lists and
the package author - it's poor form and results in a duplication
of effort.

-- 
Shaun Walbridge
GIS Developer





On 8/24/15, 4:43 AM, "R-sig-Geo on behalf of Marc Marí Dell'Olmo"
<r-sig-geo-bounces at r-project.org on behalf of marceivissa at gmail.com> wrote:

>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%E7uel
>a,+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+Barce
>lona/@41.40873,2.2057253,17z/data=!3m1!4b1!4m2!3m1!1s0x12a4a347b9b9bb8d:0x
>41b696acd7b26e37
>
>https://www.google.es/maps/place/Carrer+de+la+Mec%C3%A0nica,+12,+08038+Bar
>celona/@41.3591918,2.1379927,17z/data=!3m1!4b1!4m2!3m1!1s0x12a498a25156dc8
>b:0xc9ccfd74e54c503f
>
>
>I think that there is a problem enconding the URL. I hope anyone can
>help me! Thank you very much!
>
>
>Marc
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at r-project.org
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list