GraphHopper.com | Forum | GitHub | Maps | Blog

Map Matching Switches between two one-way streets


#1

I have a GPX file that has a number of GPS locations that are between 39th street and 38th street in Manhattan. When I try to map match the locations, the result I get is a few points going the wrong way on 39th street (moving east) and then it quickly switches to going the right direction on 38th street (also moving east).

All the GPS signals are about a second apart from one another so I would think it would snap the locations to 38th street going the right direction. Is it possible I have the wrong options setup? Any traversal mode seems to have the same issue:

AlgorithmOptions opts = AlgorithmOptions.start()
                .traversalMode(TraversalMode.EDGE_BASED_2DIR)
                .maxVisitedNodes(3000)
                .hints(new HintsMap().put("vehicle", "car").put(Parameters.CH.DISABLE, false))
                .build();

MapMatching matching = new MapMatching(graphHopper, opts);
matching.setMeasurementErrorSigma(5.0);

MatchResult matchResult = matching.doWork(entries);

Its not letting me upload the GPX file, but here is the xml:

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="JPX - https://github.com/jenetics/jpx"
xmlns="http://www.topografix.com/GPX/1/1">
<trk>
	<trkseg>
		<trkpt lat="40.75460338503193" lon="-73.99002531550265">
			<ele>13.10042953491211</ele>
			<speed>5.650000095367432</speed>
			<time>2018-12-17T18:56:37.996Z</time>
			<hdop>108.40232810106328</hdop>
			<vdop>8.0</vdop>
		</trkpt>
		<trkpt lat="40.75455648828368" lon="-73.98991635076142">
			<ele>13.30385971069336</ele>
			<speed>5.650000095367432</speed>
			<time>2018-12-17T18:56:38.996Z</time>
			<hdop>108.46232273931008</hdop>
			<vdop>12.0</vdop>
		</trkpt>
		<trkpt lat="40.75451763816248" lon="-73.98983957252837">
			<ele>14.371639251708984</ele>
			<speed>6.300000190734863</speed>
			<time>2018-12-17T18:56:39.996Z</time>
			<hdop>107.85227699175309</hdop>
			<vdop>4.0</vdop>
		</trkpt>
		<trkpt lat="40.754488469139446" lon="-73.98976866162754">
			<ele>14.632198333740234</ele>
			<speed>6.300000190734863</speed>
			<time>2018-12-17T18:56:40.996Z</time>
			<hdop>107.87412538192935</hdop>
			<vdop>4.0</vdop>
		</trkpt>
		<trkpt lat="40.754463281520415" lon="-73.98970026529766">
			<ele>14.87478256225586</ele>
			<speed>6.170000076293945</speed>
			<time>2018-12-17T18:56:41.996Z</time>
			<hdop>100.0</hdop>
			<vdop>4.0</vdop>
		</trkpt>
		<trkpt lat="40.75443331621658" lon="-73.9896395803187">
			<ele>15.03615951538086</ele>
			<speed>6.170000076293945</speed>
			<time>2018-12-17T18:56:42.996Z</time>
			<hdop>106.03703412299409</hdop>
			<vdop>4.0</vdop>
		</trkpt>
		<trkpt lat="40.75440037533711" lon="-73.9895875287">
			<ele>15.06887435913086</ele>
			<speed>6.010000228881836</speed>
			<time>2018-12-17T18:56:43.996Z</time>
			<hdop>105.02388963752165</hdop>
			<vdop>4.0</vdop>
		</trkpt>
		<trkpt lat="40.75437923973965" lon="-73.98952549275712">
			<ele>15.06887435913086</ele>
			<speed>5.881742244871977</speed>
			<time>2018-12-17T18:56:44.996Z</time>
			<hdop>208.973086063999</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75429574972631" lon="-73.98952466703106">
			<ele>15.135738372802734</ele>
			<speed>5.759987434351976</speed>
			<time>2018-12-17T18:56:45.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75423175587856" lon="-73.98950326022369">
			<ele>15.136184692382812</ele>
			<speed>5.644461469923586</speed>
			<time>2018-12-17T18:56:46.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75418104304207" lon="-73.98946336209944">
			<ele>15.142038345336914</ele>
			<speed>5.5831991693525955</speed>
			<time>2018-12-17T18:56:47.996Z</time>
			<hdop>222.18173033216158</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75413937890383" lon="-73.98941398151965">
			<ele>15.145883560180664</ele>
			<speed>5.526757989598284</speed>
			<time>2018-12-17T18:56:48.996Z</time>
			<hdop>220.89997768270786</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75410009118559" lon="-73.98936526641745">
			<ele>15.141656875610352</ele>
			<speed>5.480524629508109</speed>
			<time>2018-12-17T18:56:49.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75406168868054" lon="-73.9893163190553">
			<ele>15.1740140914917</ele>
			<speed>5.444530223384367</speed>
			<time>2018-12-17T18:56:50.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.754024397005985" lon="-73.98926796115684">
			<ele>15.236390113830566</ele>
			<speed>5.4018543135404355</speed>
			<time>2018-12-17T18:56:51.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.7539194268797" lon="-73.98928512184067">
			<ele>15.30703353881836</ele>
			<speed>5.348954605448538</speed>
			<time>2018-12-17T18:56:52.996Z</time>
			<hdop>205.0535123708124</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75383532713827" lon="-73.98928377493372">
			<ele>15.259475708007812</ele>
			<speed>5.264291495768835</speed>
			<time>2018-12-17T18:56:53.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75376762843305" lon="-73.98926926330363">
			<ele>15.248822212219238</ele>
			<speed>5.195960862197435</speed>
			<time>2018-12-17T18:56:54.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75372321652809" lon="-73.98923555335449">
			<ele>15.271146774291992</ele>
			<speed>5.128422339827649</speed>
			<time>2018-12-17T18:56:55.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.753683594949884" lon="-73.98919998600468">
			<ele>15.318537712097168</ele>
			<speed>5.047027963036673</speed>
			<time>2018-12-17T18:56:56.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.753648264071195" lon="-73.9891628632118">
			<ele>15.400727272033691</ele>
			<speed>4.977766277103489</speed>
			<time>2018-12-17T18:56:57.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75361643383223" lon="-73.98912459827216">
			<ele>15.479171752929688</ele>
			<speed>4.904074166010374</speed>
			<time>2018-12-17T18:56:58.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75357588493141" lon="-73.98908642468903">
			<ele>15.554372787475586</ele>
			<speed>4.838384602815584</speed>
			<time>2018-12-17T18:56:59.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75353118294539" lon="-73.9890479027054">
			<ele>15.622056007385254</ele>
			<speed>4.811128884466592</speed>
			<time>2018-12-17T18:57:00.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.753485950695705" lon="-73.98900883152571">
			<ele>15.680882453918457</ele>
			<speed>4.737593745819448</speed>
			<time>2018-12-17T18:57:01.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75344184374237" lon="-73.98896910823277">
			<ele>15.731164932250977</ele>
			<speed>4.665407099027363</speed>
			<time>2018-12-17T18:57:02.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75339961021296" lon="-73.98892873378443">
			<ele>15.773701667785645</ele>
			<speed>4.594477961559063</speed>
			<time>2018-12-17T18:57:03.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.753434617917186" lon="-73.98894153365454">
			<ele>15.815422058105469</ele>
			<speed>4.2727392091672165</speed>
			<time>2018-12-17T18:57:04.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75346081275837" lon="-73.98894806866892">
			<ele>15.850456237792969</ele>
			<speed>4.021729558246479</speed>
			<time>2018-12-17T18:57:05.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
		<trkpt lat="40.75347930110653" lon="-73.98894822954497">
			<ele>15.879854202270508</ele>
			<speed>3.9508339998739936</speed>
			<time>2018-12-17T18:57:06.996Z</time>
			<hdop>200.0</hdop>
			<vdop>10.0</vdop>
		</trkpt>
	</trkseg>
</trk>
</gpx>