public abstract static class MapboxMapMatching.Builder
extends java.lang.Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
abstract MapboxMapMatching.Builder |
accessToken(java.lang.String accessToken)
Required to call when this is being built.
|
MapboxMapMatching.Builder |
addApproaches(java.lang.String... approaches)
Optionally used to indicate how map matched routes consider
rom which side of the road to approach a waypoint.
|
MapboxMapMatching.Builder |
addWaypointNames(java.lang.String... waypointNames)
Custom names for waypoints used for the arrival instruction,
each separated by ; .
|
MapboxMapMatching.Builder |
annotations(java.lang.String... annotations)
Whether or not to return additional metadata along the route.
|
protected abstract MapboxMapMatching.Builder |
annotations(java.lang.String annotations) |
protected abstract MapboxMapMatching |
autoBuild() |
abstract MapboxMapMatching.Builder |
bannerInstructions(java.lang.Boolean bannerInstructions)
Setting this will determine Whether or not to return banner objects associated with
the `routeSteps`.
|
abstract MapboxMapMatching.Builder |
baseUrl(java.lang.String baseUrl)
Optionally change the APIs base URL to something other then the default Mapbox one.
|
MapboxMapMatching |
build()
This uses the provided parameters set using the
MapboxMapMatching.Builder and first checks that all
values are valid, formats the values as strings for easier consumption by the API, and lastly
creates a new MapboxMapMatching object with the values provided. |
abstract MapboxMapMatching.Builder |
clientAppName(java.lang.String clientAppName)
Base package name or other simple string identifier.
|
MapboxMapMatching.Builder |
coordinate(com.mapbox.geojson.Point coordinate)
This will add a single
Point to the coordinate list which is used to determine the
duration between points. |
MapboxMapMatching.Builder |
coordinates(java.util.List<com.mapbox.geojson.Point> coordinates)
Add a list of
Point 's which define the points to perform the map matching on. |
protected abstract MapboxMapMatching.Builder |
coordinates(java.lang.String coordinates) |
abstract MapboxMapMatching.Builder |
geometries(java.lang.String geometries)
alter the default geometry being returned for the map matching route.
|
MapboxMapMatching.Builder |
get()
Use GET method to request data.
|
MapboxMapMatching.Builder |
language(java.util.Locale language)
Set the instruction language for the map matching request, the default is english.
|
abstract MapboxMapMatching.Builder |
language(java.lang.String language)
Set the instruction language for the map matching request, the default is english.
|
abstract MapboxMapMatching.Builder |
overview(java.lang.String overview)
Type of returned overview geometry.
|
MapboxMapMatching.Builder |
post()
Use POST method to request data.
|
abstract MapboxMapMatching.Builder |
profile(java.lang.String profile)
This selects which mode of transportation the user will be using to accurately give the
map matching route.
|
MapboxMapMatching.Builder |
radiuses(java.lang.Double... radiuses)
Optionally, set the maximum distance in meters that each coordinate is allowed to move when
snapped to a nearby road segment.
|
abstract MapboxMapMatching.Builder |
roundaboutExits(java.lang.Boolean roundaboutExits)
Setting this will determine whether to return steps and turn-by-turn instructions.
|
abstract MapboxMapMatching.Builder |
steps(java.lang.Boolean steps)
Setting this will determine whether to return steps and turn-by-turn instructions.
|
abstract MapboxMapMatching.Builder |
tidy(java.lang.Boolean tidy)
Whether or not to transparently remove clusters and re-sample traces for improved map
matching results.
|
MapboxMapMatching.Builder |
timestamps(java.lang.String... timestamps)
Timestamps corresponding to each coordinate provided in the request; must be numbers in Unix
time (seconds since the Unix epoch) converted to a String.
|
protected abstract MapboxMapMatching.Builder |
timestamps(java.lang.String timestamps) |
abstract MapboxMapMatching.Builder |
user(java.lang.String user)
The username for the account that the directions engine runs on.
|
abstract MapboxMapMatching.Builder |
voiceInstructions(java.lang.Boolean voiceInstructions)
Setting this will determine whether to return steps and turn-by-turn instructions.
|
abstract MapboxMapMatching.Builder |
voiceUnits(java.lang.String voiceUnits)
Specify what unit you'd like voice and banner instructions to use.
|
MapboxMapMatching.Builder |
waypointIndices(java.lang.Integer... waypointIndices)
Optionally, set which input coordinates should be treated as waypoints / separate legs.
|
MapboxMapMatching.Builder |
waypoints(java.lang.Integer... waypoints)
Deprecated.
you should now use
waypointIndices(Integer[]) |
public MapboxMapMatching.Builder post()
public MapboxMapMatching.Builder get()
public abstract MapboxMapMatching.Builder accessToken(@NonNull java.lang.String accessToken)
ServicesException
will be thrown.accessToken
- Mapbox access token, You must have a Mapbox account inorder to use
the Map Matching APIpublic abstract MapboxMapMatching.Builder tidy(@Nullable java.lang.Boolean tidy)
tidy
- true if you'd like the API to remove coordinates clustered together, otherwise
falsepublic abstract MapboxMapMatching.Builder user(@NonNull java.lang.String user)
DirectionsCriteria.PROFILE_DEFAULT_USER
.user
- a non-null string which will replace the default user used in the map matching
requestpublic abstract MapboxMapMatching.Builder profile(@NonNull java.lang.String profile)
profile
- required to be one of the String values found in the DirectionsCriteria.ProfileCriteria
public abstract MapboxMapMatching.Builder geometries(@Nullable java.lang.String geometries)
DirectionsCriteria.GEOMETRY_POLYLINE6
.
Note that while the API supports GeoJson as an option for geometry, this SDK intentionally removes this as an option since an encoded string for the geometry significantly reduces bandwidth on mobile devices and speeds up response time.
geometries
- null if you'd like the default geometry, else one of the options found in
DirectionsCriteria.GeometriesCriteria
.public MapboxMapMatching.Builder radiuses(@Nullable java.lang.Double... radiuses)
Double.POSITIVE_INFINITY
.
If no routable road is found within the radius, a NoSegment
error is returned.
radiuses
- double array containing the radiuses defined in unit meters.@Deprecated public MapboxMapMatching.Builder waypoints(@Nullable java.lang.Integer... waypoints)
waypointIndices(Integer[])
Most useful in combination with steps=true and requests based on traces
with high sample rates. Can be an index corresponding to any of the input coordinates,
but must contain the first ( 0 ) and last coordinates' index separated by ; .
MapboxMapMatching.steps()
waypoints
- integer array of coordinate indices to be used as waypointspublic MapboxMapMatching.Builder waypointIndices(@Nullable java.lang.Integer... waypointIndices)
Most useful in combination with steps=true and requests based on traces
with high sample rates. Can be an index corresponding to any of the input coordinates,
but must contain the first ( 0 ) and last coordinates' index separated by ; .
MapboxMapMatching.steps()
waypointIndices
- integer array of coordinate indices to be used as waypointspublic abstract MapboxMapMatching.Builder steps(@Nullable java.lang.Boolean steps)
steps
- true if you'd like step informationpublic abstract MapboxMapMatching.Builder overview(@Nullable java.lang.String overview)
DirectionsCriteria.OVERVIEW_FULL
(the most
detailed geometry available), DirectionsCriteria.OVERVIEW_SIMPLIFIED
(a simplified
version of the full geometry), or DirectionsCriteria.OVERVIEW_FALSE
(no overview
geometry). The default is simplified. Passing in null will use the APIs default setting for
the overview field.overview
- null or one of the options found in DirectionsCriteria.OverviewCriteria
public abstract MapboxMapMatching.Builder bannerInstructions(@Nullable java.lang.Boolean bannerInstructions)
bannerInstructions
- true if you'd like step informationpublic abstract MapboxMapMatching.Builder voiceInstructions(@Nullable java.lang.Boolean voiceInstructions)
voiceInstructions
- true if you'd like step informationpublic abstract MapboxMapMatching.Builder voiceUnits(@Nullable java.lang.String voiceUnits)
voiceUnits
- either Imperial (default) or Metricpublic abstract MapboxMapMatching.Builder roundaboutExits(@Nullable java.lang.Boolean roundaboutExits)
roundaboutExits
- true if you'd like step informationpublic MapboxMapMatching.Builder annotations(@Nullable java.lang.String... annotations)
DirectionsCriteria.ANNOTATION_DISTANCE
,
DirectionsCriteria.ANNOTATION_DURATION
,
DirectionsCriteria.ANNOTATION_DURATION
and
DirectionsCriteria.ANNOTATION_CONGESTION
.annotations
- string referencing one of the annotation direction criteria's. The strings
restricted to one or multiple values inside the DirectionsCriteria.AnnotationCriteria
or null which will result in no annotations being usedprotected abstract MapboxMapMatching.Builder annotations(@Nullable java.lang.String annotations)
public MapboxMapMatching.Builder timestamps(@Nullable java.lang.String... timestamps)
timestamps
- timestamp corresponding to the coordinate added at the identical indexprotected abstract MapboxMapMatching.Builder timestamps(@Nullable java.lang.String timestamps)
public MapboxMapMatching.Builder coordinates(@NonNull java.util.List<com.mapbox.geojson.Point> coordinates)
Point
's which define the points to perform the map matching on. The
minimum points is 2 and the maximum points allowed in totals 100. You can use this method in
conjunction with coordinate(Point)
.coordinates
- a List full of Point
s which define the points to perform the map
matching onprotected abstract MapboxMapMatching.Builder coordinates(@NonNull java.lang.String coordinates)
public MapboxMapMatching.Builder coordinate(@NonNull com.mapbox.geojson.Point coordinate)
Point
to the coordinate list which is used to determine the
duration between points. This can be called up to 100 times until you hit the maximum allowed
points. You can use this method in conjunction with coordinates(List)
.coordinate
- a Point
which you'd like the map matching APi to perform onpublic MapboxMapMatching.Builder language(@Nullable java.util.Locale language)
language
- a Locale value representing the language you'd like the instructions to be
written in when returnedpublic abstract MapboxMapMatching.Builder language(java.lang.String language)
language
- a String value representing the language you'd like the instructions to be
written in when returnedpublic abstract MapboxMapMatching.Builder clientAppName(@NonNull java.lang.String clientAppName)
clientAppName
- base package name or other simple string identifierpublic MapboxMapMatching.Builder addApproaches(@Nullable java.lang.String... approaches)
approaches
- null if you'd like the default approaches,
else one of the options found in
DirectionsCriteria.ApproachesCriteria
.public MapboxMapMatching.Builder addWaypointNames(@Nullable java.lang.String... waypointNames)
waypointNames
- Custom names for waypoints used for the arrival instruction.public abstract MapboxMapMatching.Builder baseUrl(java.lang.String baseUrl)
baseUrl
- base url used as end pointprotected abstract MapboxMapMatching autoBuild()
public MapboxMapMatching build()
MapboxMapMatching.Builder
and first checks that all
values are valid, formats the values as strings for easier consumption by the API, and lastly
creates a new MapboxMapMatching
object with the values provided.com.mapbox.core.exceptions.ServicesException
- when a provided parameter is detected to be incorrect