Package com.mapbox.geojson.utils
Class PolylineUtils
java.lang.Object
com.mapbox.geojson.utils.PolylineUtils
Polyline utils class contains method that can decode/encode a polyline, simplify a line, and
more.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionDecodes an encoded path string into a sequence ofPoint.static StringEncodes a sequence of Points into an encoded path string.Reduces the number of points in a polyline while retaining its shape, giving a performance boost when processing it and also reducing visual noise.Reduces the number of points in a polyline while retaining its shape, giving a performance boost when processing it and also reducing visual noise.Reduces the number of points in a polyline while retaining its shape, giving a performance boost when processing it and also reducing visual noise.Reduces the number of points in a polyline while retaining its shape, giving a performance boost when processing it and also reducing visual noise.
-
Method Details
-
decode
Decodes an encoded path string into a sequence ofPoint.- Parameters:
encodedPath- a String representing an encoded path stringprecision- OSRMv4 uses 6, OSRMv5 and Google uses 5- Returns:
- list of
Pointmaking up the line - Since:
- 1.0.0
- See Also:
-
encode
Encodes a sequence of Points into an encoded path string.- Parameters:
path- list ofPoints making up the lineprecision- OSRMv4 uses 6, OSRMv5 and Google uses 5- Returns:
- a String representing a path string
- Since:
- 1.0.0
-
simplify
Reduces the number of points in a polyline while retaining its shape, giving a performance boost when processing it and also reducing visual noise.- Parameters:
points- an array of points- Returns:
- an array of simplified points
- Since:
- 1.2.0
- See Also:
-
simplify
Reduces the number of points in a polyline while retaining its shape, giving a performance boost when processing it and also reducing visual noise.- Parameters:
points- an array of pointstolerance- affects the amount of simplification (in the same metric as the point coordinates)- Returns:
- an array of simplified points
- Since:
- 1.2.0
- See Also:
-
simplify
Reduces the number of points in a polyline while retaining its shape, giving a performance boost when processing it and also reducing visual noise.- Parameters:
points- an array of pointshighestQuality- excludes distance-based preprocessing step which leads to highest quality simplification- Returns:
- an array of simplified points
- Since:
- 1.2.0
- See Also:
-
simplify
@NonNull public static List<Point> simplify(@NonNull List<Point> 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.- Parameters:
points- an array of pointstolerance- affects the amount of simplification (in the same metric as the point coordinates)highestQuality- excludes distance-based preprocessing step which leads to highest quality simplification- Returns:
- an array of simplified points
- Since:
- 1.2.0
- See Also:
-