Matching Tracks to the Road Network
The track matching tries to assign a GPS track to segments on a digital map.
Benefits
- GPS inaccuracy correction and automatic route A route corresponds to a path of a vehicle through the underlying transport network. The main attributes of a route are the distance and the time that the vehicle travels along the path. matching validation, recognising driving directions and further rules
- Create driving reports and compare real driven speed with speed limits
- Dissect driving behaviour like mileage, breaks and speeding
Prerequisites
Please ensure following prerequisites are fulfilled before you start with the use case:
- Installed and licensed PTV xMatch Service
Programming Guide
The following sample illustrates the basic steps that are necessary to match a GPS track with the matchTrack web service A web service represents a communication technology applied in computer networks. It provides an interface described in a machine-processable format, for example WSDL. API and visualize it on the map:
var map = new L.Map('map', { center: [49.61, 6.125], zoom: 13 }); // Add tile layer to map var tileUrl = xServerUrl + '/services/rest/XMap/tile/{z}/{x}/{y}'; var tileLayer = new L.TileLayer(tileUrl, { minZoom: 3, maxZoom: 18, noWrap: true }).addTo(map); var outputString=''; function matchTrack(track) { xmatch.matchTrack({ "trackPositions": track, "resultFields": { "matchedTrackPositions": true, "geometry": true }, "geometryOptions": { "responseGeometryTypes": ["GEOJSON"] } }, function(response, exception) { displayGeoJson(response.geometry.geoJSON); print("Track Positions matched: " + response.matchedTrackPositions.length); }); } function displayGeoJson(geoJson) { var jsonObject = JSON.parse(geoJson); var geoJsonLayer = new L.GeoJSON(jsonObject, { style: { color: '#2882C8', weight: 8 } }).addTo(map); map.fitBounds(geoJsonLayer.getBounds()); }; var track = [ { "coordinate": { "x": 6.115942522631116, "y": 49.61976390541412 }, "heading": 120 }, { "coordinate": { "x": 6.116124889380018, "y": 49.61960571225083 }, "heading": 120 }, { "coordinate": { "x": 6.11636625713592, "y": 49.619543130198316 } }, { "coordinate": { "x": 6.117017950076812, "y": 49.61921457310396 }, "heading": 120 }, { "coordinate": { "x": 6.117522140500224, "y": 49.61888079854931 }, "heading": 120 }]; matchTrack(track);Related Topics
The following topics might be relevant for this use case.