public class PolylineUtils extends Object
Constructor and Description 

PolylineUtils() 
Modifier and Type  Method and Description 

static List<Position> 
decode(String encodedPath,
int precision)
Decodes an encoded path string into a sequence of Positions.

static String 
encode(List<Position> path,
int precision)
Encodes a sequence of Positions into an encoded path string.

static Position[] 
simplify(Position[] points)
Reduces the number of points in a polyline while retaining its shape, giving a performance
boost when processing it and also reducing visual noise

static Position[] 
simplify(Position[] points,
boolean highestQuality)
Reduces the number of points in a polyline while retaining its shape, giving a performance
boost when processing it and also reducing visual noise.

static Position[] 
simplify(Position[] points,
double tolerance)
Reduces the number of points in a polyline while retaining its shape, giving a performance
boost when processing it and also reducing visual noise.

static Position[] 
simplify(Position[] points,
double tolerance,
boolean highestQuality)
Reduces the number of points in a polyline while retaining its shape, giving a performance
boost when processing it and also reducing visual noise.

public static List<Position> decode(String encodedPath, int precision)
encodedPath
 String
representing a path string.precision
 OSRMv4 uses 6, OSRMv5 and Google uses 5.Position
making up the line.public static String encode(List<Position> path, int precision)
public static Position[] simplify(Position[] points)
points
 an array of pointspublic static Position[] simplify(Position[] points, double tolerance)
points
 an array of pointstolerance
 affects the amount of simplification (in the same metric as the point coordinates)public static Position[] simplify(Position[] points, boolean highestQuality)
points
 an array of pointshighestQuality
 excludes distancebased preprocessing step which leads to highest quality simplificationpublic static Position[] simplify(Position[] points, double tolerance, boolean highestQuality)
points
 an array of pointstolerance
 affects the amount of simplification (in the same metric as the point coordinates)highestQuality
 excludes distancebased preprocessing step which leads to highest quality simplification© 2015–2016 Mapbox. All rights reserved.