This code sample illustrates how to use the Unified Profile Mechanism to modify the values of engine parameters via the client application. Please notice that the basic elements are described in the code sample: How to match GPS tracks in principle.
PTV recommends that the deprecated methods are replaced by using matchPositions for future development tasks. The enhancement of attributes is simply applicable without violating the downwards compatibility.
The mechanism is entirely documented in the PTV xServer manual (section: About Profile/XMapmatchProfile) according to the XSD. Use the given snippet without adding the parent element! Following attributes are to be modified:
Caution: Changing the values requires expert knowledge. Otherwise, bad or not explainable results occur.
Define the string according to the profile mechanism.
public static String codesnippet = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<Profile>" + "<Common coordinateFormat=\"OG_GEODECIMAL\" language=\"en\" majorVersion=\"1\" " + "minorVersion=\"0\">{0,1}" + "</Common>" + "<Mapmatching majorVersion=\"1\" minorVersion=\"0\" " + "probabilityBonusForBestCandidate=\"0.8\" probabilityOutputThreshold=\"0.1\">{0,1}" + "</Mapmatching>" + "</Profile>";
Define the string according to the profile mechanism.
public static String codesnippet = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<Profile>" + "<Common coordinateFormat=\"OG_GEODECIMAL\" language=\"en\" majorVersion=\"1\" " + "minorVersion=\"0\">{0,1}" + "</Common>" + "<Mapmatching majorVersion=\"1\" minorVersion=\"0\" " + "probabilityBonusForBestCandidate=\"0.8\" probabilityOutputThreshold=\"0.1\">{0,1}" + "</Mapmatching>" + "</Profile>";
If the code snippet is incorrect defined following XServiceException (exemplarily) will occur after executing the method: "Could not parse profile. Reason: Error at line 1, column 162: expected end of tag..."
Set key ProfileXMLSnippet and add code snippet as String object.
CallerContextProperty props3 = new CallerContextProperty(); props3.setKey("ProfileXMLSnippet"); props3.setValue(codesnippet);
Set key ProfileXMLSnippet and add code snippet as String object.
CallerContextProperty props3 = new CallerContextProperty(); props3.key = "ProfileXMLSnippet"; props3.value = codesnippet;
The method contains two mandatory arguments as follows:
Call method.
matchPositions = client.matchPositions(trackPositions, details);
Call method.
MatchResult matchPositions = client.matchPositions(trackPositions, details, cxt);
The matched segments are displayed by the corresponding polyline.
The following table exemplarily illustrates the relevant attributes provided by the matchResult list.
Copyright © 2024 PTV Logistics GmbH All rights reserved. | Imprint