match_highway: Coordinates Map Matching

Description Usage Arguments Value Examples

Description

Snap a set of GPS coordinates in WGS84 to the OpenStreetMap (OSM) data highways. This function facilitates the common process in two ways:

Usage

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/")

Arguments

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 "%Y-%m-%d %H:%M:%S"

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 get_boxes function by ~boxtable$boxcuts)

boxlist

(Optional) A matrix of size 4 X p of bounding boxes coordinates with rows of ("left","bottom","right","top"); it can be generated from the get_boxes function by ~boxlist)

resolution

(Optional) Approximate value of distance within each bounding box in kilometers; to be used for get_boxes

offLong

(Optional) A positive value of bounding box longitudal margin in decimal degrees; to be used for get_boxes

offLat

(Optional) A positive value of bounding box latitudal margin in decimal degrees; to be used for get_boxes

osmlink

(Optional) The API link for the OpenStreetMap data

Value

match_highway return a vector of size n for highway link IDs based on OpenStreetMap

Examples

 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)

farinoushsharifi/TransGPS documentation built on June 3, 2019, 7:19 a.m.