symbolixau / googleway Goto Github PK
View Code? Open in Web Editor NEWR Package for accessing and plotting Google Maps
Home Page: http://symbolixau.github.io/googleway/
License: Other
R Package for accessing and plotting Google Maps
Home Page: http://symbolixau.github.io/googleway/
License: Other
shouldn't be included
no longer seem to be working
https://stackoverflow.com/a/38024257/5977215
add_marker( )
functionlat.length
, for exampleThe JS latlngNorth & south objects are not defined correctly
In google_directions()
, while it is already noted that lists with elements named via
will be processed as non-stopping waypoints, it took hunting through the source code to realise that they need to be named ""
(explicitly empty character) to be used otherwise. You have fatal testing for this in-place, but it's not documented.
Given that you explicitly write the via:
prefix anyway, I'd like to suggest adding stop
to the list of valid names in your package, which can then be left out from the actual API call.
update_map_view
should be on all map layers
Given the API doesn't actually require you to have a key; do we want to make it optional, but say that it is recommended to do so?
place_id
values for origin / destinationtraffic_mode
is used without departure_time
jqr
google_distance
My team are currently building a tool that uses your googleway R code.
We LOVE IT! so thanks for putting it together.
We've hit a bit of a snag however.
There seems to be some issue with timeouts.
We are attempting to get drive time on 140k records for our exercise.
We've successfully got results on approx 20k records but it has timed out twice.
The first time we didn't check the run time, but the 2nd time it ran for ~2 hours and then timed out.
I wonder if you know if there's a setting we can tweak to avoid the time out so that our job runs to completion and could help us doctor the code a little to allow this to occur?
If the location/address information is all the same type (e.g., all lat/lon pairs, or all string address), allow a data.frame to be passed into the functions.
For waypoints, allow three columns, the third to identify 'stopover' or 'via'. In google the default is 'stopover'.
if there are both of lat & latidue (and lon and longitude) columns, currently the first is used. Should this be explicitly stated, or as an option to the user through an error?
I am facing issues in calling the package under proxy:
Error in open.connection(con, "rb") : Couldn't resolve host name
I tried to call:
library(httr)
set_config(
use_proxy(url="myproxy", port=80,
username="myusername",password="mypass")
)
then call
mykeyKey='mykey'
library(googleway)
df <- google_geocode(address = "Via G. Pogliani 6 Paderno Dugnano",
key = mykeyKey,
simplify = TRUE)
without results...
Is it possible to find a workaround?
implement a function for Google Places API
Currently waypoints are only available for transit, walking or bicycling modes. Are there any plans to make waypoints available for driving mode so the user can calculate the time taken between origin. destination and waypoints in between?
Hi. I'm using google_places of googleway package.
I am triying to loop to the next pages using the page_token;
I put as input the df_temp$next_page_token.
The first two loops work.
The third return dataframe$next_page_token = NULL
Is it a problem with the interface?
Thanks
However, jsonlite::fromJSON()
has it's own error handling...
info_window
argument not working
The key
parameter for all functions refers to the Directions API. It should refer to the API in which the key is used.
incldue all optional parameters
https://developers.google.com/maps/documentation/directions/intro#RequestParameters
test-google_directions()
related StackOverflow question: http://stackoverflow.com/q/37719070/5977215
Use skip_on_cran
, rather than just skip
, so the api calls can be tested with a local API key.
(see comments in #9 )
as per StackOverflow
Sample polylines:
pl1 <- "q{|aHknlv@n@Mt@IxAGb@B\\Eb@AZGRG^W`AyAPQF?NHDJFZBz@FVNPn@D`@C|@DjACv@@h@Dh@Ll@Zj@^\\`@fAx@j@r@d@n@\\ZJPNd@NbANzAFhANb@JNLHD?PKHMRGPSr@UPMXGDGJELMFCPAbBWROpAm@h@YZe@dAaC@Of@aAb@a@t@iALg@LWNQROf@IjAJnFbAv@Dr@Aj@BpBx@fFdCd@HlAHd@Pp@b@|@d@~@j@n@R~@n@\\NTCXBNEZCZKbB]rAKpDK~BO\\?NCd@?`DMz@SLO`@URCR@XLRRRVHd@NXNP\\RXf@JHXN\\Xn@ZD@Z?\\NvArA~BxA"
pl2 <- "uipaHmmcv@iBoFm@{AKQy@}B}AoDyA_CASEMGKKI]y@i@y@EOi@q@kAw@KEMAu@M]?[@WDkAZiB~@]H_@PUF]TUL_@XkAn@}CzAyAx@e@P_@JSNGROPa@Fu@[UOc@IOAu@_@WIUMIIWGu@]YEk@SoBiAc@_@gAeAg@{@]mAMq@YmBA]Oq@YuBKYUg@UQa@QiAOI@QIm@EiA[w@BSFYZ_@h@]t@o@bAOb@}@zAWn@_@jAGf@SbAKbAKXSpAS`@ICa@FSHICQ@gAHq@KSAa@I[CQ@k@KOGMKYg@aBkEs@u@k@g@_@a@{@o@W]IAYQYAsDIODc@LW\\GRKn@Ch@WtAO`BCzAIj@Wh@SRc@NS@a@KaAg@kCgAm@]iBo@w@_@UQc@S}@Ww@e@MCa@Sm@Sk@WYI{@g@IIMAMIIIm@QuBaAIGu@_@SQiAqA_AmASSYIUEqAKQBm@Im@Qe@i@k@UQBSCe@NO?[FKFYBSH_ADa@GQIw@OOSKF[b@M@gAl@i@b@{@b@OLwAj@KLWRI@yBvAuAd@m@F_@@qAEk@Kc@Oi@_@_@e@oAeBc@u@SSi@]i@We@Im@Q}@k@w@_@i@a@w@a@SQ[Qy@OeCSUGg@WSOa@e@W]MK_@i@CMMWIEMWa@m@[QEIICK@QHUTe@n@ELKFa@l@u@t@WNYLYXO?IBGHc@Tc@Ja@@{@Q{@]s@a@kBq@YOcAYs@IU?_@NU@GAu@^a@LSPg@X]^YJc@h@]PKHI@w@n@]h@AXEJMTCZc@|AS`@OVg@j@_Av@{@bA"
it's possible to send in the polylines directly : https://developers.google.com/maps/documentation/elevation/intro
Hi, I'm new to github, so please tell if I'm not using this session in the right way.
I'm using googleway to find nearby places based on a lat/long (first I'll need gas_stations, then general places). I made some tests, and it is not finding all locations, I'll give an example:
To check if it was in google as a real place, I went to Places API developers page and got the 'Place ID', which is: ChIJHRauPxYeowcRfVIL9Cd29zM
I checked the ID on the googleway function to get some info, which was all correct, including the 'gas_station' tag:
local_info <- google_place_details(place_id = 'ChIJHRauPxYeowcRfVIL9Cd29zM',
key = chave)
structure(local_info)
Then, I made some tests, trying to find this gas station based on its location within a radius (I tried with 50, 100, 1000 and 5000):
gas_stations <- google_places(place_type = 'gas_station',
location = c(-6.362805, -39.306283),
radius=1000,
key = chave)
structure(gas_stations)
Which returned some Gas Stations, but not this one.
I also tried using keywords and a search_string, but it was also unsuccessful.
Do you know why it is not finding this one? Also many other specific establishments?I'm using for Brazil only, is this a problem?
Thanks very much for this awesome package, and I hope you can understand my english.
EDIT: I've tested with a link provided by developers page, and it is returning this gas station I gave as an example. The inputs where exactly the same (location, radius and type):
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-6.362805,%20-39.306283&radius=500&types=gas_station&key=YOUR_KEY
In testing it seems as though radius in the google_places function has no effect. Setting it to 1 or 10,000 gives the same result for me.
Vignette examples need to use simplify
instead of output_format
.
The API offers the option to optimize the waypoints in order to get the best/shortest path via (optimize:true
) Link.
It comes in handy especially if you have a lot of unordered waypoints and don't have the possibility to order them beforehand.
Cheers
I try to decode the overview polyline from this request and got cannot be decoded error:
"https://maps.googleapis.com/maps/api/directions/json?origin=place_id:ChIJg0QqCUx-bIcRTdSPo8yl9XA&destination=39.763262,-105.143201&mode=driving&units=imperial&departure_time=1482433621&traffic_model=pessimistic&avoid=highway&key=[KEY]"
aweqF~~v_SgVGAoM@iFaT@oEAoAA}@?oBzBqHpI}@bawf@MTe@p@{HJkBlC]v@kAlAgGnHmInKwEtGeA|Aq@pAWn@k@jBy@tDeBhIq@FmAlBw@dA{ClDsHhIiDzDSVuA|B{AbCiBbCcEdEmAdAmBrAiDrBoChAeCx@yGjBkCr@yEbAaAL_APs@Ju@@}A@sACoAIcAOcB_@cA[{By@{BaAiCw@}Ds@s@EeAIsCCwA?mFHE?i@FgBZqAD]jAm@lB_@|@_A~AmAdBw@|@oAbAsA|@kBt@kBn@aHbCcFlBcHjDqCvA_HrDaAb@yBnA_E
CiBfBs@x@{@nAiAlBkD@gAh@YNUNuBfBwC
D_BBcBbBqBbBwAv@_Bf@eARcALyABoBI{A[cD_A_D}@wBq@aEyAmAc@c@SiBgAaAq@eEcEaB{BsB{CwA{Bs@gAwNyT_FwHuHwMkAqBeBsCaBoBmAkAcBwA}B{AkBoA_@_@aC}A_Aq@q@k@_AcAmAsBe@aAiAiDk@aB]wAaDwKa@yA[cAOe@BG?M?ICMuAwEk@oAy@uA]i@qAwAMQCIQO_DeC}CeBgBw@mBm@oA]aB[eC[sCSwCCaMEk@GiAWm@IoDoBw@Ym@G_ABm@TMJg@^y@fASl@Ib@EPCZC
@cf@DzF@A@@@xbcCQfC[rBsAtHo@|DaAxGGd@?j@wAfHeAbGWzBIMGlMEfXUvDa@tDq@bHGhAKbE?hBHbFPDFhBRxCf@
HHdCChBs@hQQdGEFb@
HjAlNZdDNdCB~BExBEfBSIChF?rM?jUGbCIh@Q~Aa@hB{@~BmBjF[pAObAStBCzCB~@
@pd^B|@hCnAxCt@vBRt@XbBLtAFdBBnM@fb@?bB[~TIdCGbA]rCk@zCYfA{@fC{@rBo@jA_B|B{BpCyAxBe@|@i@bBe@rBQfBElBBlBLpB
@rdpc|Qb@pCvAKb@~CpBfNbBzKz@~FXnCDt@JzBDpBHlP@bd@AfJObE}@fOU
FCrE@td@Fll@F|FPnFZfFb@pEz@vGn@pDp@~CnJt^pHrXrAFdAjD
@daf@AnAjBt@bApAlAx@h@^T~At@pA
@`ARvALlDDhDCnXEff@O
It can be decoded with [https://developers.google.com/maps/documentation/utilities/polylineutility](polyline utility tool).
use 'simplify' in stead of 'output_format' . Simplify will be coerced into a list using jsonlite::fromJSON()
When I run the following function I get a message that there was an error. When I check the URL this works.
google_distance(origins = list(c("Melbourne Airport, Australia"),
+ c("MCG, Melbourne, Australia"),
+ c(-37.81659, 144.9841)),
+ destinations = c("Portsea, Melbourne, Australia"),
+ key = key,
+ simplify = FALSE)
NULL
Warning message:
In value[[3L]](cond) :
There was an error downloading results. Please manually check the following URL is valid by entering it into a browswer. If valid, please file a bug report citing this URL (note: your API key has been removed, so you will need to add that back in)
https://maps.googleapis.com/maps/api/distancematrix/json?&origins=Melbourne+Airport,+Australia|MCG,+Melbourne,+Australia|-37.81659,144.9841&destinations=Portsea,+Melbourne,+Australia&departure_time=1502273016&alternatives=false&units=metric&mode=driving&key=
>
Updates planed for future releases
event_return_type
- list or JSON (in google_map()
)update_heatmap
search_box
searchupdate_
functionswould this be useful, or just a waste of time?
There is an icon argument in the Google Maps APIs for adding a custom image to be used for the marker instead of the default. This would be super useful and (I think) not too hard to implement.
I notice there's no error control around curl::curl(map_url)
; this would not be too hard to do safely, either with tryCatch()
or purrr::safely()
. I'd guess that would be feedback you received from CRAN anyway.
Some processing on the returned data would be useful too; I received a few empty returns with
result$status
#> [1] "ZERO_RESULTS"
Checking the status_code for success would be useful, returning a helpful message otherwise. When deployed within a shiny
app, errors don't always float to the top the way one might hope.
The mode
argument is not used correctly
Currently I'm working on some visualisations on the workings of intersections (traffic lights). The default precision of jsonlite::toJSON of 4 digits is too low for that. For other inner city related projecs the default precision is too low as well (e.g. building contours, locating GPS equipped objects, etc.).
Please add a parameter 'digits' to the add_polylines function (and friends / similar functions) that is passed to the digits parameter of the toJSON function (default value = 4). This approach gives fine control of the number of digits used for each time a function is used. A global "options" variable for 'digits' is another solution, but gives less (or at least counterintuitive) control.
Perhaps another solution is even better and perhaps I have missed something that enables higher precision allready. I couldn't find a global paramter for jsonlite (only stetting through 'digits' directly in the toJSON function).
To check the solution, I 'hacked' a copy of googleway and replaced the toJSON function with one of my own with a higher default and that did the trick for me.
(received via email)
This is not working (only single selection):
avoid = c("TOLLS", "highways")
I found the issue to google. They have written that you must use %7C to join 2 or more restrictions in avoid. May you check it?
Polylines in Chrome and Rstudio viewer can handle 6 or 8 character hex colours, shiny only seems to be able to handle 6
#FFFFFFFF
vs
#FFFFFF
Need to investigate
I'm planning on using googleway
to add some route-estimating functionality to ubeR
(see datawookie/ubeR#1) but of course not everyone has a Google Maps API key.
Thus:
googleway
functions?googleway
API key (limited access, read-only, dedicated account) with a request to not abuse it? I'm sure I've seen this in a package somewhere, but can't recall where.googleway
or ubeR
, I just thought I'd run it by you first.Alternatively, I'll just have it fail if the user doesn't have a valid key. That's not too harsh given that they need to be able to get an Uber API key anyway.
Hi, thank you for the wonderful R package.
Since I am using the company network, I need to use the proxy to receive the data.
Usually I can set the proxy for library httr or Rcurl, (ggmap uses GET function from httr so I could use proxy for that), I saw that googleway imports curl library so I tried everything I could but I still cannot make it.. Could you let me know how can I set the proxy to use the google_distance function without problem? Thank you
for google_distance I have a following error
Error in readLines(con) : Couldn't connect to server
and for google_direction I have a following error
Error in open.connection(con, "rb") : Couldn't connect to server
Rather than break anyone's code with an update, consider leaving it in (revert that file to c6b01c2) for a version or two but add
.Deprecated("google_directions")
as per http://r-pkgs.had.co.nz/release.html#release-version .
Package looks good, I'll be seeing if I can integrate functionality into one of mine. Cheers.
to accept a place_id
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.