public static class MapboxStaticImage.Builder extends MapboxBuilder
baseUrl, clientAppName
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
MapboxStaticImage |
build()
Build the client when all user parameters have been set.
|
String |
getAccessToken()
Get the access token
|
String |
getBeforeLayer()
Provides the string being used to represent the layer you wish to place all your overlays below.
|
String |
getGeoJson()
If a
GeoJSON object was provided, you can get the formatted version of it by calling this method. |
String |
getLocationPathSegment()
Gives location information about the static image including longitude, latitude, zoom,
bearing, and pitch.
|
String |
getOverlays()
Provides a String containing all of the currently added overlays added to the static image builder.
|
int |
getPrecision() |
String |
getSizePathSegment()
Gives the height and width of the static image.
|
String |
getStyleId()
Get what map style your static image will display.
|
String |
getUsername()
Get the username you set within the builder.
|
boolean |
isAttribution()
Determine if the static image will contain attribution.
|
boolean |
isAuto()
Determine if auto has been set for the static image camera positioning.
|
boolean |
isLogo()
Determine if the static image will contain Mapbox logo.
|
MapboxStaticImage.Builder |
setAccessToken(String accessToken)
Required to call when building
MapboxStaticImage.Builder . |
MapboxStaticImage.Builder |
setAttribution(boolean attribution)
Optionally, control whether there is attribution on the image.
|
MapboxStaticImage.Builder |
setAuto(boolean auto)
If auto is set to true, the viewport will fit the bounds of the overlay.
|
MapboxBuilder |
setBaseUrl(String baseUrl)
Set the base url of the API.
|
MapboxStaticImage.Builder |
setBearing(double bearing)
Optionally, bearing rotates the map around its center.
|
MapboxStaticImage.Builder |
setBeforeLayer(String beforeLayer)
String value for controlling where the overlay is inserted in the style.
|
MapboxStaticImage.Builder |
setClientAppName(String appName)
Set the App Name to identify
|
MapboxStaticImage.Builder |
setGeoJson(com.mapbox.services.commons.geojson.GeoJSON geoJson)
Pass in a
GeoJSON object which contains geometry where you'd like your annotations to be placed. |
MapboxStaticImage.Builder |
setHeight(int height)
Height of the image.
|
MapboxStaticImage.Builder |
setLat(double lat)
Latitude for the center point of the static map.
|
MapboxStaticImage.Builder |
setLocation(com.mapbox.services.commons.models.Position position)
Deprecated.
Use
setPosition(Position) instead. |
MapboxStaticImage.Builder |
setLogo(boolean logo)
Optionally, control whether there is a Mapbox logo on the image.
|
MapboxStaticImage.Builder |
setLon(double lon)
Longitude for the center point of the static map.
|
MapboxStaticImage.Builder |
setPitch(double pitch)
Optionally, pitch tilts the map, producing a perspective effect.
|
MapboxStaticImage.Builder |
setPosition(com.mapbox.services.commons.models.Position position)
Location for the center point of the static map.
|
MapboxStaticImage.Builder |
setPrecision(int precision)
In order to make the returned images better cacheable on the client, you can set the
precision in decimals instead of manually rounding the parameters.
|
MapboxStaticImage.Builder |
setRetina(boolean retina)
Optionally, use to request a retina 2x image that will be returned.
|
MapboxStaticImage.Builder |
setStaticMarkerAnnotations(StaticMarkerAnnotation... staticMarkerAnnotations)
Allows the passing of a
StaticMarkerAnnotation or Markers which are placed on the static map image
returned. |
MapboxStaticImage.Builder |
setStaticPolylineAnnotations(StaticPolylineAnnotation... staticPolylineAnnotations)
Allows the passing of a
StaticPolylineAnnotation or Polylines which are placed on the static map image
returned. |
MapboxStaticImage.Builder |
setStyleId(String styleId)
You'll need to set what map style you'd like the static image to display.
|
MapboxStaticImage.Builder |
setUsername(String username)
Set the map style username.
|
MapboxStaticImage.Builder |
setWidth(int width)
Width of the image.
|
MapboxStaticImage.Builder |
setZoom(double zoom)
static map zoom level.
|
getBaseUrl, getClientAppName, validateAccessToken
public String getGeoJson()
GeoJSON
object was provided, you can get the formatted version of it by calling this method.public MapboxStaticImage.Builder setGeoJson(com.mapbox.services.commons.geojson.GeoJSON geoJson)
GeoJSON
object which contains geometry where you'd like your annotations to be placed.geoJson
- a single GeoJSON
object which includes at least one annotation.public MapboxStaticImage.Builder setAccessToken(String accessToken)
MapboxStaticImage.Builder
.setAccessToken
in class MapboxBuilder
accessToken
- Mapbox access token, you must have a Mapbox account in order to use
this library.public MapboxStaticImage.Builder setUsername(String username)
username
- You will need to pass in your Mapbox username.public MapboxStaticImage.Builder setStyleId(String styleId)
styleId
- can be one of the defaults or your own.public MapboxStaticImage.Builder setLon(double lon)
lon
- double number between -180 and 180.public MapboxStaticImage.Builder setLat(double lat)
lat
- double number between -90 and 90.@Deprecated public MapboxStaticImage.Builder setLocation(com.mapbox.services.commons.models.Position position)
setPosition(Position)
instead.position
- Position object with valid latitude and longitude valuespublic MapboxStaticImage.Builder setPosition(com.mapbox.services.commons.models.Position position)
position
- Position object with valid latitude and longitude valuespublic MapboxStaticImage.Builder setZoom(double zoom)
zoom
- double number between 0 and 22.public MapboxStaticImage.Builder setBearing(double bearing)
bearing
- double number between 0 and 360, interpreted as decimal degrees.public MapboxStaticImage.Builder setPitch(double pitch)
pitch
- double number between 0 and 60.public MapboxStaticImage.Builder setAuto(boolean auto)
auto
- true if you'd like the viewport to be centered to display all map annotations, defaults false.public boolean isAuto()
public MapboxStaticImage.Builder setWidth(int width)
width
- int number between 1 and 1280.public MapboxStaticImage.Builder setHeight(int height)
height
- int number between 1 and 1280.public MapboxStaticImage.Builder setRetina(boolean retina)
retina
- true if you'd like a retina image.public MapboxStaticImage.Builder setAttribution(boolean attribution)
attribution
- true places attribution on image.public MapboxStaticImage.Builder setLogo(boolean logo)
logo
- true places Mapbox logo on image.public MapboxStaticImage.Builder setPrecision(int precision)
precision
- int number representing the precision for the formatterpublic MapboxStaticImage.Builder setBeforeLayer(String beforeLayer)
beforeLayer
- A string representing the map layer you'd like to place your overlays below.public String getBeforeLayer()
public String getAccessToken()
getAccessToken
in class MapboxBuilder
public String getUsername()
public String getStyleId()
public String getLocationPathSegment()
public String getSizePathSegment()
public MapboxStaticImage.Builder setStaticMarkerAnnotations(StaticMarkerAnnotation... staticMarkerAnnotations)
StaticMarkerAnnotation
or Markers which are placed on the static map image
returned.staticMarkerAnnotations
- One or more StaticMarkerAnnotation
s to be placed on your static image.public MapboxStaticImage.Builder setStaticPolylineAnnotations(StaticPolylineAnnotation... staticPolylineAnnotations)
StaticPolylineAnnotation
or Polylines which are placed on the static map image
returned.staticPolylineAnnotations
- One or more StaticPolylineAnnotation
s to be placed on your static image.public String getOverlays()
public boolean isAttribution()
public boolean isLogo()
public int getPrecision()
public MapboxStaticImage.Builder setClientAppName(String appName)
MapboxBuilder
setClientAppName
in class MapboxBuilder
appName
- base package name or other simple string identifierpublic MapboxBuilder setBaseUrl(String baseUrl)
setBaseUrl
in class MapboxBuilder
baseUrl
- base url used as end pointpublic MapboxStaticImage build() throws ServicesException
build
in class MapboxBuilder
ServicesException
- Generic Exception for all things Mapbox.© 2015–2016 Mapbox. All rights reserved.