UrlTemplateImageryProvider

Provides imagery by requesting tiles using a specified URL template.

// Access Natural Earth II imagery, which uses a TMS tiling scheme and Geographic (EPSG:4326) project
const tms = new UrlTemplateImageryProvider({
url : buildModuleUrl('Assets/Textures/NaturalEarthII') + '/{z}/{x}/{reverseY}.jpg',
tilingScheme : new GeographicTilingScheme(),
maximumLevel : 5
});
// Access the CartoDB Positron basemap, which uses an OpenStreetMap-like tiling scheme.
const positron = new 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.
const wms = new 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 : Rectangle.fromDegrees(96.799393, -43.598214999057824, 153.63925700000001, -9.2159219997013)
});
// Using custom tags in your template url.
const custom = new UrlTemplateImageryProvider({
url : 'https://yoururl/{Time}/{z}/{y}/{x}.png',
customTags : {
Time: function(imageryProvider, x, y, level) {
return '20171231'
}
}
});

See also

Constructors

Link copied to clipboard

Types

Link copied to clipboard
sealed interface ConstructorOptions

Initialization options for the UrlTemplateImageryProvider constructor

Properties

Link copied to clipboard

Gets the credit to display when this imagery provider is active. Typically this is used to credit the source of the imagery.

Link copied to clipboard

Gets or sets a value indicating whether feature picking is enabled. If true, UrlTemplateImageryProvider.pickFeatures will request the options.pickFeaturesUrl and attempt to interpret the features included in the response. If false, UrlTemplateImageryProvider.pickFeatures will immediately return undefined (indicating no pickable features) without communicating with the server. Set this property to false if you know your data source does not support picking features or if you don't want this provider's features to be pickable.

Link copied to clipboard

Gets an event that is raised when the imagery provider encounters an asynchronous error. By subscribing to the event, you will be notified of the error and can potentially recover from it. Event listeners are passed an instance of TileProviderError.

Link copied to clipboard

Gets a value indicating whether or not the images provided by this imagery provider include an alpha channel. If this property is false, an alpha channel, if present, will be ignored. If this property is true, any images without an alpha channel will be treated as if their alpha is 1.0 everywhere. When this property is false, memory usage and texture upload time are reduced.

Link copied to clipboard

Gets the maximum level-of-detail that can be requested, or undefined if there is no limit.

Link copied to clipboard

Gets the minimum level-of-detail that can be requested.

Link copied to clipboard

Gets the URL template to use to use to pick features. If this property is not specified, UrlTemplateImageryProvider.pickFeatures will immediately return undefined, indicating no features picked. The URL template supports all of the keywords supported by the UrlTemplateImageryProvider.url property, plus the following:

Link copied to clipboard

Gets the proxy used by this provider.

Link copied to clipboard

Gets the rectangle, in radians, of the imagery provided by this instance.

Link copied to clipboard

Gets the tile discard policy. If not undefined, the discard policy is responsible for filtering out "missing" tiles via its shouldDiscardImage function. If this function returns undefined, no tiles are filtered.

Link copied to clipboard

Gets the height of each tile, in pixels.

Link copied to clipboard

Gets the width of each tile, in pixels.

Link copied to clipboard

Gets the tiling scheme used by this provider.

Link copied to clipboard
val url: String

Gets the URL template to use to request tiles. It has the following keywords:

Link copied to clipboard

Gets the URL scheme zero padding for each tile coordinate. The format is '000' where each coordinate will be padded on the left with zeros to match the width of the passed string of zeros. e.g. Setting: urlSchemeZeroPadding : { '{x}' : '0000'} will cause an 'x' value of 12 to return the string '0012' for {x} in the generated URL. It has the following keywords:

Functions

Link copied to clipboard

Gets the credits to be displayed when a given tile is displayed.

Link copied to clipboard
suspend fun pickFeatures(x: Double, y: Double, level: Int, longitude: Double, latitude: Double): ReadonlyArray<ImageryLayerFeatureInfo>?

Asynchronously determines what features, if any, are located at a given longitude and latitude within a tile.

Link copied to clipboard
Link copied to clipboard
suspend fun requestImage(x: Double, y: Double, level: Int, request: Request? = definedExternally): ImageryTypes?
Link copied to clipboard
fun requestImageAsync(x: Double, y: Double, level: Int, request: Request? = definedExternally): Promise<ImageryTypes>?