rCarto / photon

:dart: R Interface to the Photon API / Interface entre R et l'API de photon
http://rgeomatic.hypotheses.org/?p=622
45 stars 8 forks source link

Update geocode.R API address #16

Closed datapumpernickel closed 3 years ago

datapumpernickel commented 3 years ago

updated api address and made small change to replace "&" with "and" in request. This would require the package stringr.
Also, for some reason RCurl did not work for me. Replaced it with GET from httr. Sorry, this is the first time I propose changes. Please let me know if something is off. Thanks.

rCarto commented 3 years ago

Hello, thank you for your contribution. In commit 5ac5089cae3a5877e6e8d943b298f332d86473dc I have only changed the demo server address and everything seems to work now. I don't understand the change from "&" to "and" in request. Is there a change in the API?

datapumpernickel commented 3 years ago

Hello, I agree, if it works for you, best to just fix the address. I will see if I can reproduce the error I had previously. Currently, I am geocoding some twitter data and sometimes users specify a literal "&" in the location. If that gets passed on to the api it creates an error I think, because URLencode("&") returns "&". If for example somebody writes "Berlin & Potsdam" it will create an error in the function. I did not investigate further and just went ahead and replaced all "&" with "and".

Thank you again for the nice package!

rCarto commented 3 years ago

Ok, I understand now. Your suggestion is to add a step to clean "malformed" string inputs. I prefer to let this task to the user as much as possible, to keep the package light.