Description Usage Arguments Value Examples
Snap a set of GPS coordinates in WGS84 to the OpenStreetMap (OSM) data highways. This function facilitates the common process in two ways:
Dividing the whole region into bounding boxes, which allows using the OSM data through API sourcing instead of setting up an OSM data server
Implementation of a fast K-Nearest Neighbor method to find the closest K links to each GPS coordinate
1 2 3 4 5 6 | match_highway(LatList, LongList, timeseq, k,
boxcuts = as.numeric(get_boxes(LatList, LongList, timeseq, resolution,
offLong, offLat)$boxtable$boxcuts),
boxlist = as.matrix(get_boxes(LatList, LongList, timeseq, resolution,
offLong, offLat)$boxlist), resolution = 5, offLong = 0.001,
offLat = 0.001, osmlink = "https://api.openstreetmap.org/api/0.6/")
|
LatList |
A vector of size n for latitudes collected from a GPS recording device |
LongList |
A vector of size n for longitudes collected from a GPS recording device |
timeseq |
A vector of size n for irregular time sequence of recorded GPS data in format |
k |
Value of maximum number of close highways; to consider for the KNN analysis |
boxcuts |
(Optional) A vector of size n with p levels for the bounding box split of GPS coordinates; it can be generated from the |
boxlist |
(Optional) A matrix of size 4 X p of bounding boxes coordinates with rows of |
resolution |
(Optional) Approximate value of distance within each bounding box in kilometers; to be used for |
offLong |
(Optional) A positive value of bounding box longitudal margin in decimal degrees; to be used for |
offLat |
(Optional) A positive value of bounding box latitudal margin in decimal degrees; to be used for |
osmlink |
(Optional) The API link for the OpenStreetMap data |
match_highway
return a vector of size n for highway link IDs based on OpenStreetMap
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | LatList <- c(31.67514,31.675195,31.67625,
31.676304,31.676356,31.677408,31.677467,
31.677517,31.677569,31.677623)
LongList <- c(-106.326522,-106.326367,
-106.326111,-106.325958,-106.325901,
-106.325639,-106.325372,-106.32441,
-106.324247,-106.324092)
timeseq <- c("2019-04-29 15:20:51",
"2019-04-29 15:21:03","2019-04-29 15:21:06",
"2019-04-29 15:21:15","2019-04-29 15:21:17",
"2019-04-29 15:21:32","2019-04-29 15:21:34",
"2019-04-29 15:21:51","2019-04-29 15:22:09",
"2019-04-29 15:22:36")
timeseq <- as.POSIXct(timeseq)
k=3
resolution <- 0.1
offLong=0.001
offLat=0.002
match_highway(LatList, LongList, timeseq, k,
resolution = resolution,offLong = offLong, offLat = offLat)
boxcuts <- c(1,1,1,2,2,3,3,3,4,4)
boxlist <- cbind(c(-106.32752,31.67414,-106.28746,31.69790),
c(-106.26872,31.73050,-106.26627,31.77233),
c(-106.26915,31.77057,-106.26671,31.81236),
c(-106.36679,31.81582,-106.34707,31.84163))
match_highway(LatList, LongList, timeseq,
k, boxcuts=boxcuts, boxlist=boxlist)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.