google_snapToRoads {googleway} | R Documentation |
Snap To Roads
Description
Takes up to 100 GPS coordinates collected along a route and returns a similar set of data, with the points snapped to the most likely roads the vehicle was treveling along
Usage
google_snapToRoads(
df_path,
lat = NULL,
lon = NULL,
interpolate = FALSE,
simplify = TRUE,
curl_proxy = NULL,
key = get_api_key("roads")
)
Arguments
df_path |
|
lat |
string specifying the column of |
lon |
string specifying the column of |
interpolate |
logical indicating whether to interpolate a path to
include all points forming the full road-geometry.
When |
simplify |
|
curl_proxy |
a curl proxy object |
key |
|
API use and limits
The amount of queries you can make to Google's APIs is dependent on both the service and the API you are using.
Each API has specific quotas and limits. Check Google's API documentation for details.
View your usage at the Google Cloud Console https://console.cloud.google.com/
Each API can only accept and return one request at a time. If you write a loop to make multiple API calls you should ensure you don't go over your quota / limits during the loop.
Note
The snapping algorithm works best for points that are not too far apart. If you observe odd snapping behaviour, try creating paths that have points closer together. To ensure the best snap-to-road quality, you should aim to provide paths on which consecutive pairs of points are within 300m of each other. This will also help in handling any isolated, long jumps between consecutive points caused by GPS signal loss or noise.
See Also
Examples
## Not run:
key <- 'your_api_key'
df_path <- read.table(text = "lat lon
-35.27801 149.12958
-35.28032 149.12907
-35.28099 149.12929
-35.28144 149.12984
-35.28194 149.13003
-35.28282 149.12956
-35.28302 149.12881
-35.28473 149.12836", header = T)
google_snapToRoads(df_path, key = key, interpolate = TRUE, simplify = TRUE)
## End(Not run)