Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,10 @@ public void onResponse(Call<MapMatchingResponse> call, Response<MapMatchingRespo
// Check that the map matching API response is "OK".
if (response.code() == 200) {
// Convert the map matched response list from position to latlng coordinates.
// By default, the SDK uses MapMatchingCriteria.GEOMETRY_POLYLINE_6, therefore
// you need Constants.PRECISION_6 for the decode to be right
String geometry = response.body().getMatchings().get(0).getGeometry();
List<Position> positions = PolylineUtils.decode(geometry, Constants.OSRM_PRECISION_V4);
List<Position> positions = PolylineUtils.decode(geometry, Constants.PRECISION_6);
if (positions == null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ public class Constants {
/**
* Constants for polyline encoding/decoding
*/

// Use these if you want to be explicit about the vendor
public static final int GOOGLE_PRECISION = 5;
public static final int OSRM_PRECISION_V4 = 6;
public static final int OSRM_PRECISION_V5 = 5;

// Use these if you want to be explicit about the precision
public static final int PRECISION_5 = 5;
public static final int PRECISION_6 = 6;

/**
* Default user for services
*/
Expand Down