new UrlTemplateImageryProvider()
Provide images by requesting tiles using a specified URL template.
| Name | Type | Default | Description |
|---|---|---|---|
options.url |
String |
URL template for requesting tiles. It contains the following keywords:
|
|
options.pickFeaturesUrl |
String |
optional
URL template used for feature selection. If this property is not specified, the URL Template ImageryProvider # pickFeatures will immediately return undefined, indicating that no features have been selected. The URL template supports all keywords supported by URL parameters, as well as the following keywords:
|
|
options.urlSchemeZeroPadding |
Object |
optional
Get the URL scheme zero padding for each tile coordinate. The format is' 000 ', where each coordinate will be filled with a zero on the left to match the width of the passed zero string. For example, setting: urlSchemeZeroPadding: {'{x} ':' 0000 '} will result in the value of' x 'being 12 and the return string' 0012 'representing {x} in the generated URL. If the object being passed has the following keywords:
|
|
options.subdomains |
String | Array.<String> | 'abc' |
optional
The subdomain to be used for the {s} placeholder in the URL template. If it is a single string, each character in the string represents a subdomain. If it is an array, then each element in the array is a subdomain. |
options.proxy |
Object |
optional
Proxy used for requests. This object should have a getURL function to return the proxy URL. |
|
options.credit |
Credit | String | '' |
optional
The copyright statement of the data source is displayed on the canvas. |
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
The rectangle covered by the image (in radians). |
options.tilingScheme |
TilingScheme | WebMercatorTilingScheme |
optional
Specify the tile scheme for dividing ellipsoidal surfaces into tiles. If this parameter is not provided, use the WebMercatorTilingScheme. |
options.ellipsoid |
Ellipsoid |
optional
Ellipsoid. If a tile scheme is specified, ignore this parameter and use the ellipsoid of the tile scheme. If no parameters are specified, use WGS84 ellipsoid. |
|
options.tileWidth |
Number | 256 |
optional
The pixel width of the image tile. |
options.tileHeight |
Number | 256 |
optional
The pixel height of the image tile. |
options.hasAlphaChannel |
Boolean | true |
optional
If the image provided by the image provider contains an alpha channel, it is true; Otherwise, it is false. If this attribute is false, the alpha channel (if present) will be ignored. If this attribute is true, any image without an alpha channel will be considered to have an alpha value of 1.0. If this attribute is false, it may reduce memory usage and texture upload time. |
options.getFeatureInfoFormats |
Array.<GetFeatureInfoFormat> |
optional
The format for obtaining feature information at a specific location when calling the URL Template ImageryProvider # pickFeatures. If this parameter is not specified, the feature selection function will be disabled. |
|
options.enablePickFeatures |
Boolean | true |
optional
If it is true, the URL Template ImageryProvider # pickFeatures will request options.pickFeatures URL and attempt to interpret the features contained in the response. If false, the URL Template ImageryProvider # pickFeatures will immediately return undefined (indicating no selectable features) and will not communicate with the server. If you know that your data source does not support feature selection, or if you do not want the features provided by the program to be selectable, please set this property to false. Please note that this property can be dynamically reloaded by modifying the UriTemplate ImageryProvider # enablePickFeatures property. |
- See:
Example
// Access Natural Earth II imagery, which uses a TMS tiling scheme and Geographic (EPSG:4326) project
var tms = new SuperMap3D.UrlTemplateImageryProvider({
url : 'https://cesiumjs.org/tilesets/imagery/naturalearthii/{z}/{x}/{reverseY}.jpg',
credit : '© Analytical Graphics, Inc.',
tilingScheme : new SuperMap3D.GeographicTilingScheme(),
maximumLevel : 5
});
// Access the CartoDB Positron basemap, which uses an OpenStreetMap-like tiling scheme.
var positron = new SuperMap3D.UrlTemplateImageryProvider({
url : 'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
credit : 'Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL.'
});
// Access a Web Map Service (WMS) server.
var wms = new SuperMap3D.UrlTemplateImageryProvider({
url : 'https://programs.communications.gov.au/geoserver/ows?tiled=true&' +
'transparent=true&format=image%2Fpng&exceptions=application%2Fvnd.ogc.se_xml&' +
'styles=&service=WMS&version=1.1.1&request=GetMap&' +
'layers=public%3AMyBroadband_Availability&srs=EPSG%3A3857&' +
'bbox={westProjected}%2C{southProjected}%2C{eastProjected}%2C{northProjected}&' +
'width=256&height=256',
rectangle : SuperMap3D.Rectangle.fromDegrees(96.799393, -43.598214999057824, 153.63925700000001, -9.2159219997013)
});
Members
-
readonly creditCredit
-
Obtain the copyright statement to be displayed when this image provider is active. This is usually used to prove the source of the image. This function should not be called before the URL Template ImageryProvider # ready returns true.
- Default Value: undefined
enablePickFeaturesBoolean
Gets or sets a value indicating whether feature selection is enabled. If true, the URL Template ImageryProvider # pickFeatures will request options. Pick Features URL and attempt to explain the features included in the response. If false, the URL Template ImageryProvider # pickFeatures will immediately return undefined (indicating no selectable features) without communicating with the server. If you know that your data source does not support feature selection, or if you do not want the feature of this provider to be selectable, please set this property to false.
- Default Value: true
readonly errorEventEvent
Retrieve the event triggered when the image provider encounters an asynchronous error. By subscribing to events, you will receive error notifications and may potentially recover from them. The event listener is passed an instance of TileProviderError.
readonly hasAlphaChannelBoolean
Obtain a value indicating whether the image provided by the image provider contains an alpha channel. If the attribute is false, the existing alpha channel will be ignored. If this attribute is true, any image that does not contain an alpha channel will be considered as an image with an alpha value of 1.0. If this attribute is false, it will reduce memory usage and texture upload time. This function should not be called until ImageryProvider # ready returns true.
- Default Value: true
readonly maximumLevelNumber
Get the maximum level of granularity that can be requested, if there are no restrictions, it is undefined. This function should not be called before UrlTemplateImageryProvider # ready returns true.
- Default Value: undefined
readonly minimumLevelNumber
Get the minimum level of granularity that can be requested, if there are no restrictions, it is undefined. This function should not be called before UrlTemplateImageryProvider # ready returns true.
- Default Value: 0
readonly pickFeaturesUrlString
Get the URL template to be used for selecting features. If this property is not specified, the URL Template ImageryProvider # pickFeatures will immediately return undefined, indicating no feature selection. All keywords that are supported by the property, such as the URL Template ImageryProvider # URL property, should be added with the following content:
- {i}: The pixel column (x-coordinate) of the selected position, where the westernmost pixel is 0.
- {j}: The pixel row (y-coordinate) of the selected position, where the northernmost pixel is 0.
- {reverseI}: The pixel column (x-coordinate) of the selected position, where the easternmost pixel is 0.
- {reverseJ}: The pixel row (y-coordinate) of the selected position, where the southernmost pixel is 0.
- {longitudeDegrees}: The longitude of the selected position in degrees.
- {latitudeDegrees}: The latitude of the selected position in degrees.
- {longitudeProjected}: The longitude of the selected position in the projected coordinates of the tiling scheme.
- {latitudeProjected}: The latitude of the selected position in the projected coordinates of the tiling scheme.
- {format}: The format for obtaining feature information, as specified in GetFeatureInfoFormat.
readonly proxyProxy
Get the proxy used by this provider.
- Default Value: undefined
readonly readyBoolean
Get a value indicating whether the provider is ready to use.
readonly readyPromisePromise.<Boolean>
Get a Promise that parses to true when the provider is ready to use.
readonly rectangleRectangle
Obtain the rectangle (in radians) of the image provided by this instance. This function should not be called before UrlTemplateImageryProvider # ready returns true.
- Default Value: tilingScheme.rectangle
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 the URL Template ImageryProvider # ready returns true.
- Default Value: undefined
readonly tileHeightNumber
Get the height of each tile in pixels. This function should not be called before the URL Template ImageryProvider # ready returns true.
- Default Value: 256
readonly tileWidthNumber
Get the width of each tile in pixels. This function should not be called before the URL Template ImageryProvider # ready returns true.
- Default Value: 256
readonly tilingSchemeTilingScheme
Obtain the tile scheme used by this provider. This function should not be called before UrlTemplateImageryProvider # ready returns true.
- Default Value: new WebMercatorTilingScheme()
readonly urlString
Get the URL template used to request tiles. It has the following keywords:
- {z}: The level of the tile in the tiling scheme. Level 0 is the root of the quadtree pyramid.
- {x}: The tile X coordinate in the tiling scheme, where 0 represents the westernmost tile.
- {y}: The tile Y coordinate in the tiling scheme, where 0 represents the northernmost tile.
- {s}: One of the available subdomains, used to overcome the browser's limit on the number of simultaneous requests per host.
- {reverseX}: The tile X coordinate in the tiling scheme, where 0 represents the easternmost tile.
- {reverseY}: The tile Y coordinate in the tiling scheme, where 0 represents the southernmost tile.
- {reverseZ}: The level of the tile in the tiling scheme, where level 0 is the maximum level of the quadtree pyramid. To use reverseZ, maximumLevel must be defined.
- {westDegrees}: The west side of the tile in geodetic degrees.
- {southDegrees}: The south side of the tile in geodetic degrees.
- {eastDegrees}: The east side of the tile in geodetic degrees.
- {northDegrees}: The north side of the tile in geodetic degrees.
- {westProjected}: The west side of the tile in the projected coordinates of the tiling scheme.
- {southProjected}: The south side of the tile in the projected coordinates of the tiling scheme.
- {eastProjected}: The east side of the tile in the projected coordinates of the tiling scheme.
- {northProjected}: The north side of the tile in the projected coordinates of the tiling scheme.
- {width}: The width of each tile in pixels.
- {height}: The height of each tile in pixels.
readonly urlSchemeZeroPaddingObject
Get the URL scheme 0 for each tile coordinate to fill in. The format is "000", where each coordinate will be filled with a zero on the left to match the width of the passed 0 string. Setting: urlSchemeZeroPadding: {'{x} ':' 0000 '} will result in a' x 'value of 12 returning the string' 0012 ', which is used to generate {x} in the URL. Contains the following keywords:
- {z}: Zero-padded tile level in the tiling scheme.
- {x}: Zero-padded tile X coordinate in the tiling scheme.
- {y}: Zero-padded tile Y coordinate in the tiling scheme.
- {reverseX}: Zero-padded reverse X coordinate of the tile in the tiling scheme.
- {reverseY}: Zero-padded reverse Y coordinate of the tile in the tiling scheme.
- {reverseZ}: Zero-padded reverse Z level of the tile in the tiling scheme.
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 before ImageryProvider # 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.
longitudeNumber Select the longitude of the feature.
latitudeNumber Select the latitude of the feature.
Returns:
Type Description Promise.<Array.<ImageryLayerFeatureInfo>> | undefined The Promise for the selected feature will be resolved upon completion of asynchronous selection. The parsed value is an array of ImageryLayerElementInfo instances. If no features are found at the given location, the array may be empty. If selection is not supported, it may also be undefined. -
reinitialize(options)
-
Reinitialize the instance. Support reinitializing instances that are already in use, but it is not recommended as the existing tiles provided by the image provider will not be updated.
Name Type Description optionsPromise.<Object> | Object Any options that can be passed to the UrlTemplateImageryProvider constructor.
-
requestImage(x, y, level, request){Promise.<(Image|Canvas)>|undefined}
-
Request to specify the image of the tile. This function should not be called before UrlTemplateImageryProvider # 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.
Returns:
Type Description Promise.<(Image|Canvas)> | undefined A promise for the image, which will be parsed when the image is available. If there are too many active requests to the server, it will not be defined and the request should be retried later. The parsed image can be an image object or a Canvas DOM object.