I have taken several gps readings while driving around town.
gpsPositions=GeoPosition[{{33.657, -84.5197}, {33.6687, -84.4977},
{33.692, -84.4907}, {33.7057, -84.4287}, {33.7431, -84.4027}, {33.7285,
-84.3493}}]
map = GeoGraphics[GeoMarker[gpsPositions],
GeoRange ->Entity["City",{"Atlanta","Georgia","UnitedStates"}],ImageSize->Large]
Were are able to extract the main roads by the following functions:
bgnd = GeoGraphics[ GeoRange ->Entity["City",{"Atlanta","Georgia","UnitedStates"}],ImageSize->Large];
roads = DeleteSmallComponents@
Thinning@ImageAdd[
Dilation[#, DiskMatrix[3]] & /@
DominantColors[bgnd, 7, {"CoverageImage", "Color"}][[5 ;; 6, 1]]];
ImageCompose[map, ColorNegate@SetAlphaChannel[roads, roads]]
Road Extraction worked fine. Now convert the gpsPositions and map them to the road image.
range = Abs[#1 - #2] & @@@ map[[8, 2]]
origin = #1 & @@@ map[[8, 2]];
max = Reverse@ImageDimensions[roads];
waypoints = gpsPositions[[1]];
points = Reverse@(Round[(max (#)/range), 1]) & /@ ((# - origin) & /@
waypoints);
Show[ColorNegate@roads,
Graphics[{Red, PointSize[Large], Point[points]}]]
I would like to be able to segment the lines between the dots. Then, set up an interpolation function between each dot so we can simulate the placement of the vehicle at any point of the road as needed.
Any thoughts on how this can be achieved?
range
appears to be undefined. $\endgroup$