Skip to content

feat: mapmatching - accept GeoJSON, WKT, WKB and Polyline formats#3273

Open
karololszacki wants to merge 8 commits into
graphhopper:masterfrom
karololszacki:feat/mapmatching-improvements
Open

feat: mapmatching - accept GeoJSON, WKT, WKB and Polyline formats#3273
karololszacki wants to merge 8 commits into
graphhopper:masterfrom
karololszacki:feat/mapmatching-improvements

Conversation

@karololszacki

@karololszacki karololszacki commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

This PR adds support for MapMatching in formats:

  • GeoJSON
  • Well-Known Text (WKT) for LineString
  • Well-Known Binary (WKB) also for LineString
  • Polyline (5 and 6)

This should (partly) resolve #2773, which asked for non-gpx MapMatching.

GeoJSON parsing needed one additional import from JTS (Java Topology Suite), namely their reader.

I tried to separate changes into logical commits / steps.
I am not primarily a Java dev, but I have tried my best to stick to your conventions and to best practices in general.

@karololszacki karololszacki changed the title feat: mapmatching - accept WKT, WKB and Polyline formats feat: mapmatching - accept GeoJSON, WKT, WKB and Polyline formats Jan 26, 2026
Comment on lines -125 to -134
private LineString readWktLineString(String wkt) {
WKTReader wktReader = new WKTReader();
LineString expectedGeometry = null;
try {
expectedGeometry = (LineString) wktReader.read(wkt);
} catch (ParseException e) {
e.printStackTrace();
}
return expectedGeometry;
}

@karololszacki karololszacki Jan 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This func was actually moved from the test file into MapMatchingResource in ee36913
Recently it got replaced with the generic version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Map Matching with list of Coordinates (not gpx file)

1 participant