Second assignment for EE 495: Geospatial Vision and Visualization, Northwestern University, Spring 2020.
Given probe data that was collected for several months, do the following in a map:
- Map match probe points to road links.
- Derive road slope for each road link.
- Evaluate the derived road slope with the surveyed road slope in the link data file.
- Pandas
- gmaps
- Haversine
- Input a probe point of the form [
latitude
,longitude
]. - Create Pandas DataFrame that contains [
linkPVID
,shapeInfo
,shapeList
] columns fromPartition6467LinkData.csv
. - Add a column
distFromLink
which contains the distance from the probe point to the nearest link. This is done by applying a Lambda function to the entries of theshapeInfo
column of the DataFrame. This Lambda function takes the minimum Great Circle distance (using haversine Python library function) of the probe point to all [latitude
,longitude
] pairs fromshapeInfo
column of DataFrame. - Identify the link by acquiring the corresponding link’s
linkPVID
. - The output file
Partition6467MatchedPoints.csv
also requiresdistFromLink
— the distance of each probe point to reference node of link. To do this:- Acquire corresponding index of the
linkPVID
in DataFrame. - Use this index to get first entry of
shapeInfo
of each link, which is the ref node. - Calculate Great Circle distance from probe point to ref node.
- Acquire corresponding index of the
- Use Pandas function
groupby()
to group link matching DataFrame rows to eachlinkPVID
. - Acquire probe points that matched to each
linkPVID
. - Iterate through probe points, calculating distance between them and altitude difference between them.
- Calculate slope for each pair in degrees using
arctan(changeInAltitude/distance)
. - After iterating, take average of all slopes of each link and output it.
- Calculate error between this and the average of slopes per link of
Partition6467LinkData.csv
.
- From visualizing the probe points and links in gmaps, it is observed that points are matched to corresponding link correctly for the most part.
- Slope results turned out to be relatively similar to the theoretical slope values, but total average error of 0.24 degrees does seem high considering that the error is higher than some slope values themselves.
- As mentioned before, slope accuracy can be improved, possibly by using a higher sample size or more robust algorithms.
- The main reason such a small sample size was used (when compared to the total sample size) is that the code is very slow.
- Other metrics can be combined with Great Circle distance to determine link matching.