new MapboxImageryProvider()
Provide tile images hosted by Mapbox.
| Name | Type | Default | Description |
|---|---|---|---|
options.url |
String | 'https://api.mapbox.com/v4/' |
optional
Mapbox server URL. |
options.mapId |
String |
Mapbox Map ID |
|
options.accessToken |
String |
optional
Public access token for images. |
|
options.format |
String | 'png' |
optional
The format of the image request. |
options.proxy |
Object |
optional
Proxy used for requests. The object should have a getURL function to return the proxy URL. |
|
options.ellipsoid |
Ellipsoid |
optional
Ellipsoid. If not specified, use WGS84 ellipsoid. |
|
options.minimumLevel |
Number | 0 |
optional
The minimum level of detail supported by the imaging provider. When specifying this option, please note that the number of tiles at the minimum level should be small, such as 4 or less. Larger numbers may cause presentation issues. |
options.maximumLevel |
Number |
optional
The maximum level of detail supported by the image provider is undefined if there are no restrictions. |
|
options.rectangle |
Rectangle | Rectangle.MAX_VALUE |
optional
A rectangle covered by an image, measured in radians. |
options.credit |
Credit | String |
optional
The copyright statement of the data source is displayed on the canvas. |
- See:
Example
// Mapbox tile provider
var mapbox = new SuperMap3D.MapboxImageryProvider({
mapId: 'mapbox.streets',
accessToken: 'thisIsMyAccessToken'
});
Members
-
readonly creditCredit
-
Obtain the copyright statement to be displayed when activating the image provider. Usually used to indicate the source of the image. This function should not be called before MapboxImageryProvider # ready returns true.
-
readonly errorEventEvent
-
Retrieve the event triggered when the image provider encounters an asynchronous error. By subscribing to this event, you will receive error notifications and may potentially recover from them. The event listener will receive an instance of TileProviderError.
-
readonly hasAlphaChannelBoolean
-
Get a value indicating whether the image provided by this image provider includes an alpha channel. If this attribute is false, the alpha channel is ignored. If this property is true, any image without an alpha channel will be processed
-
readonly maximumLevelNumber
-
Obtain the maximum level of granularity that can be requested. This function should not be called until MapboxImageryProvider # ready returns true.
-
readonly minimumLevelNumber
-
Obtain the minimum level of granularity that can be requested. This function should not be called until MapboxImageryProvider # ready returns true. Generally speaking, the minimum level can only be used when the rectangular range of the image is small enough that there are enough blocks at the minimum level. Only when the number of tiles at the minimum level is very small, should the minimum level be used. If the minimum number of tiles in the image provider exceeds a few, it will cause rendering problems.
-
readonly proxyProxy
-
Get the proxy used by the provider.
-
readonly readyBoolean
-
Get a value indicating whether the provider can use it.
-
readonly readyPromisePromise.<Boolean>
-
Get the Promise that parses to true when the provider is ready.
-
readonly rectangleRectangle
-
Obtain the rectangle (in radians) of the image provided by the instance. This function should not be called before MapboxImageryProvider # ready returns true.
-
readonly tileDiscardPolicyTileDiscardPolicy
-
Obtain tile discard strategy. If not defined, the discard policy is responsible for filtering out "lost" tiles through its should DiscardImage function. If this function returns undefined, it will not filter any tiles. This function should not be called until MapboxImageryProvider # ready returns true.
-
readonly tileHeightNumber
-
Get the height of each tile in pixels. This function should not be called before MapboxImageryProvider # ready returns true.
-
readonly tileWidthNumber
-
Get the width of each tile in pixels. This function should not be called before MapboxImageryProvider # ready returns true.
-
readonly tilingSchemeTilingScheme
-
Obtain the slicing scheme used by the provider. This function should not be called before MapboxImageryProvider # ready returns true.
-
readonly urlString
-
Get the URL of the Mapbox server.
Methods
-
getTileCredits(x, y, level){Array.<Credit>}
-
Obtain the copyright statement to be displayed when displaying a given tile.
Name Type Description xNumber The X-coordinate of the tile.
yNumber The y-coordinate of the tile.
levelNumber The level of tiles.
Throws:
-
GetTileCredits must not be called before the video provider is ready.
- Type
- DeveloperError
Returns:
Type Description Array.<Credit> The copyright statement to be displayed when displaying tiles. -
-
pickFeatures(x, y, level, longitude, latitude){Promise.<Array.<ImageryLayerFeatureInfo>>|undefined}
-
Asynchronous determination of the terrain features (if any) at the given longitude and latitude in the tile. This function should not be called until MapboxImageryProvider # ready returns true. This function is optional, so not all image providers have this function.
Name Type Description xNumber The X-coordinate of the tile.
yNumber The y-coordinate of the tile.
levelNumber The level of tiles.
longitudeNumber Select the longitude of the feature.
latitudeNumber Select the latitude of the feature.
Throws:
-
PickFeatures must not be called before the video provider is ready.
- Type
- DeveloperError
Returns:
Type Description Promise.<Array.<ImageryLayerFeatureInfo>> | undefined When asynchronous extraction is completed, the Promise of the extracted features will be parsed. The parsed value is an array composed of ImageryLayerElementInfo instances. If no features are found at the given location, the array may be empty. If extraction is not supported, the array may also be undefined. -
-
requestImage(x, y, level, request){Promise.<(Image|Canvas)>|undefined}
-
Request to specify the image of the tile. This function should not be called before MapboxImageryProvider # ready returns true.
Name Type Description xNumber The X-coordinate of the tile.
yNumber The y-coordinate of the tile.
levelNumber The level of tiles.
requestRequest optional Request object. For internal use only.
Throws:
-
RequestImage must not be called before the image provider is ready.
- Type
- DeveloperError
Returns:
Type Description Promise.<(Image|Canvas)> | undefined Promise of the image, which promises to parse the image when it is available; If there are too many requests on the server, the Promise is not defined and the requests should be retried later. The parsed image can be an image or a Canvas DOM object. -