UrlTemplateImageryProvider

new Cesium.UrlTemplateImageryProvider(options)

通过使用指定的URL模板请求平铺来提供图像。
Name Type Description
options UrlTemplateImageryProvider.ConstructorOptions 描述初始化选项的对象
Example:
// Access Natural Earth II imagery, which uses a TMS tiling scheme and Geographic (EPSG:4326) project
var tms = new Cesium.UrlTemplateImageryProvider({
    url : Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII') + '/{z}/{x}/{reverseY}.jpg',
    credit : '© Analytical Graphics, Inc.',
    tilingScheme : new Cesium.GeographicTilingScheme(),
    maximumLevel : 5
});
// Access the CartoDB Positron basemap, which uses an OpenStreetMap-like tiling scheme.
var positron = new Cesium.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 Cesium.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 : Cesium.Rectangle.fromDegrees(96.799393, -43.598214999057824, 153.63925700000001, -9.2159219997013)
});
// Using custom tags in your template url.
var custom = new Cesium.UrlTemplateImageryProvider({
   url : 'https://yoururl/{Time}/{z}/{y}/{x}.png',
   customTags : {
       Time: function(imageryProvider, x, y, level) {
           return '20171231'
       }
   }
});
See:

Members

获取此图像提供程序处于活动状态时显示的点数。通常这是用来信用的 图像的来源。在UrlTemplateImageryProvider#ready返回true之前,不应调用此函数。
Default Value: undefined

defaultAlpha : Number|undefined

此提供程序的默认alpha混合值,0.0表示完全透明和 1.0表示完全不透明。
Default Value: undefined

defaultBrightness : Number|undefined

此提供程序的默认亮度。1.0使用未修改的图像颜色。小于1.0 使图像变暗,大于1.0将使图像更亮。
Default Value: undefined

defaultContrast : Number|undefined

此提供程序的默认对比度。1.0使用未修改的图像颜色。小于1.0减少 大于1.0时,对比度会增加。
Default Value: undefined

defaultDayAlpha : Number|undefined

默认的alpha混合值,在这个提供程序的全局日侧,0.0表示完全透明和 1.0表示完全不透明。
Default Value: undefined

defaultGamma : Number|undefined

要应用于此提供程序的默认gamma校正。1.0使用未修改的图像颜色。
Default Value: undefined

defaultHue : Number|undefined

此提供程序的默认色调(以弧度为单位)。0.0使用未修改的图像颜色。
Default Value: undefined
要应用于此提供程序的默认纹理放大过滤器。
Default Value: undefined
要应用于此提供程序的默认纹理缩小筛选器。
Default Value: undefined

defaultNightAlpha : Number|undefined

默认的alpha混合值出现在这个提供者的地球仪的夜间,0.0表示完全透明 1.0表示完全不透明。
Default Value: undefined

defaultSaturation : Number|undefined

此提供程序的默认饱和度。1.0使用未修改的图像颜色。小于1 大于1.0时的饱和度会增加。
Default Value: undefined

enablePickFeatures : Boolean

获取或设置一个值,该值指示是否启用功能选取。如果为真,UrlTemplateImageryProvider#pickFeatures将 请求options.pickFeaturesUrl并尝试解释响应中包含的功能。如果是假的, UrlTemplateImageryProvider#pickFeatures将立即返回未定义(表示不可拾取 功能)而不与服务器通信。如果知道数据,请将此属性设置为false 源不支持拾取功能,或者您不希望此提供程序的功能可拾取。
Default Value: true
获取在映像提供程序遇到异步错误时引发的事件。通过订阅 对于事件,您将收到错误通知,并可能从中恢复。事件侦听器 传递给TileProviderError的实例。

readonly hasAlphaChannel : Boolean

获取一个值,该值指示此图像提供程序是否提供图像 包括一个alpha通道。如果此属性为false,则alpha通道(如果存在)将 被忽视。如果此属性为true,则将处理没有alpha通道的任何图像 好像他们的alpha到处都是1.0。当此属性为false时,内存使用率 减少了纹理上传时间。这个功能应该 在ImageryProvider#ready返回true之前不调用。
Default Value: true

readonly maximumLevel : Number|undefined

获取可以请求的最大详细级别,如果没有限制,则为未定义的详细级别。 在UrlTemplateImageryProvider#ready返回true之前,不应调用此函数。
Default Value: undefined

readonly minimumLevel : Number

获取可请求的最低详细级别。这个功能应该 在UrlTemplateImageryProvider#ready返回true之前不调用。
Default Value: 0

readonly pickFeaturesUrl : String

获取用于选择功能的URL模板。如果未指定此属性, UrlTemplateImageryProvider#pickFeatures将立即返回undefined,表示否 选择的功能。URL模板支持 UrlTemplateImageryProvider#url房产,加上以下各项:
  • {i}: The pixel column (horizontal coordinate) of the picked position, where the Westernmost pixel is 0.
  • {j}: The pixel row (vertical coordinate) of the picked position, where the Northernmost pixel is 0.
  • {reverseI}: The pixel column (horizontal coordinate) of the picked position, where the Easternmost pixel is 0.
  • {reverseJ}: The pixel row (vertical coordinate) of the picked position, where the Southernmost pixel is 0.
  • {longitudeDegrees}: The longitude of the picked position in degrees.
  • {latitudeDegrees}: The latitude of the picked position in degrees.
  • {longitudeProjected}: The longitude of the picked position in the projected coordinates of the tiling scheme.
  • {latitudeProjected}: The latitude of the picked position in the projected coordinates of the tiling scheme.
  • {format}: The format in which to get feature information, as specified in the GetFeatureInfoFormat.
获取此提供程序使用的代理。
Default Value: undefined

readonly ready : Boolean

获取一个值,该值指示提供程序是否可以使用。

readonly readyPromise : Promise.<Boolean>

获取在提供程序准备好使用时解析为true的承诺。
获取此实例提供的图像的矩形(以弧度为单位)。这个功能应该 在UrlTemplateImageryProvider#ready返回true之前不调用。
Default Value: tilingScheme.rectangle
获取磁贴丢弃策略。如果不是未定义,则由丢弃策略负责 用于通过其shouldDiscardImage函数过滤掉“丢失”的瓷砖。如果这个函数 返回未定义的,不过滤分片。这个功能应该 在UrlTemplateImageryProvider#ready返回true之前不调用。
Default Value: undefined

readonly tileHeight : Number

获取每个平铺的高度(以像素为单位)。这个功能应该 在UrlTemplateImageryProvider#ready返回true之前不调用。
Default Value: 256

readonly tileWidth : Number

获取每个平铺的宽度(以像素为单位)。这个功能应该 在UrlTemplateImageryProvider#ready返回true之前不调用。
Default Value: 256
获取此提供程序使用的平铺方案。这个功能应该 在UrlTemplateImageryProvider#ready返回true之前不调用。
Default Value: new WebMercatorTilingScheme()
获取用于请求平铺的URL模板。它有以下关键字:
  • {z}: The level of the tile in the tiling scheme. Level zero is the root of the quadtree pyramid.
  • {x}: The tile X coordinate in the tiling scheme, where 0 is the Westernmost tile.
  • {y}: The tile Y coordinate in the tiling scheme, where 0 is the Northernmost tile.
  • {s}: One of the available subdomains, used to overcome browser limits on the number of simultaneous requests per host.
  • {reverseX}: The tile X coordinate in the tiling scheme, where 0 is the Easternmost tile.
  • {reverseY}: The tile Y coordinate in the tiling scheme, where 0 is the Southernmost tile.
  • {reverseZ}: The level of the tile in the tiling scheme, where level zero is the maximum level of the quadtree pyramid. In order to use reverseZ, maximumLevel must be defined.
  • {westDegrees}: The Western edge of the tile in geodetic degrees.
  • {southDegrees}: The Southern edge of the tile in geodetic degrees.
  • {eastDegrees}: The Eastern edge of the tile in geodetic degrees.
  • {northDegrees}: The Northern edge of the tile in geodetic degrees.
  • {westProjected}: The Western edge of the tile in projected coordinates of the tiling scheme.
  • {southProjected}: The Southern edge of the tile in projected coordinates of the tiling scheme.
  • {eastProjected}: The Eastern edge of the tile in projected coordinates of the tiling scheme.
  • {northProjected}: The Northern edge of the tile in projected coordinates of the tiling scheme.
  • {width}: The width of each tile in pixels.
  • {height}: The height of each tile in pixels.

readonly urlSchemeZeroPadding : Object

获取每个平铺坐标的URL方案零填充。格式为'000',其中每个坐标将被填充 带零的左边与传递的零字符串的宽度相匹配。e、 g.设置: urlSchemeZeroPadding:{x}':'0000'} 将导致值为12的“x”返回生成的URL中{x}的字符串“0012”。 它有以下关键字:
  • {z}: The zero padding for the level of the tile in the tiling scheme.
  • {x}: The zero padding for the tile X coordinate in the tiling scheme.
  • {y}: The zero padding for the the tile Y coordinate in the tiling scheme.
  • {reverseX}: The zero padding for the tile reverseX coordinate in the tiling scheme.
  • {reverseY}: The zero padding for the tile reverseY coordinate in the tiling scheme.
  • {reverseZ}: The zero padding for the reverseZ coordinate of the tile in the tiling scheme.

Methods

getTileCredits(x, y, level)Array.<Credit>

获取显示给定磁贴时要显示的点数。
Name Type Description
x Number 平铺X坐标。
y Number 平铺Y坐标。
level Number 瓷砖水平;
Returns:
显示磁贴时要显示的学分。
Throws:
  • DeveloperErrorgetTileCredits在图像提供商准备就绪之前不得调用。

pickFeatures(x, y, level, longitude, latitude)Promise.<Array.<ImageryLayerFeatureInfo>>|undefined

异步地确定哪些要素(如果有的话)位于给定的经度和纬度内 一块瓷砖。在ImageryProvider#ready返回true之前,不应调用此函数。
Name Type Description
x Number 平铺X坐标。
y Number 平铺Y坐标。
level Number 平铺层。
longitude Number 选择要素的经度。
latitude Number 选择要素的纬度。
Returns:
对于所选功能的承诺,将在异步 拣选完成。解析值是一个ImageryLayerFeatureInfo数组 实例。如果在给定位置找不到特征,则数组可能为空。 如果不支持拣选,也可能未定义。
重新初始化此实例。支持重新初始化已在使用的实例,但不支持 建议使用,因为图像提供商提供的现有磁贴将不会更新。
Name Type Description
options Promise.<Object> | Object 可以传递给UrlTemplateImageryProvider构造函数的任何选项。

requestImage(x, y, level, request)Promise.<(HTMLImageElement|HTMLCanvasElement)>|undefined

请求给定磁贴的图像。这个功能应该 在UrlTemplateImageryProvider#ready返回true之前不调用。
Name Type Description
x Number 平铺X坐标。
y Number 平铺Y坐标。
level Number 平铺层。
request Request optional 请求对象。仅供内部使用。
Returns:
对映像的承诺,当映像可用时将解决该问题,或 如果对服务器的活动请求太多,则未定义 应该稍后重试。解析图像可以是 图像或画布DOM对象。

Type Definitions

Cesium.UrlTemplateImageryProvider.ConstructorOptions

UrlTemplateImageryProvider构造函数的初始化选项
Properties:
Name Type Attributes Default Description
options Promise.<Object> | Object <optional>
具有以下属性的对象:
url Resource | String 用于请求平铺的URL模板。它有以下关键字:
  • {z}: The level of the tile in the tiling scheme. Level zero is the root of the quadtree pyramid.
  • {x}: The tile X coordinate in the tiling scheme, where 0 is the Westernmost tile.
  • {y}: The tile Y coordinate in the tiling scheme, where 0 is the Northernmost tile.
  • {s}: One of the available subdomains, used to overcome browser limits on the number of simultaneous requests per host.
  • {reverseX}: The tile X coordinate in the tiling scheme, where 0 is the Easternmost tile.
  • {reverseY}: The tile Y coordinate in the tiling scheme, where 0 is the Southernmost tile.
  • {reverseZ}: The level of the tile in the tiling scheme, where level zero is the maximum level of the quadtree pyramid. In order to use reverseZ, maximumLevel must be defined.
  • {westDegrees}: The Western edge of the tile in geodetic degrees.
  • {southDegrees}: The Southern edge of the tile in geodetic degrees.
  • {eastDegrees}: The Eastern edge of the tile in geodetic degrees.
  • {northDegrees}: The Northern edge of the tile in geodetic degrees.
  • {westProjected}: The Western edge of the tile in projected coordinates of the tiling scheme.
  • {southProjected}: The Southern edge of the tile in projected coordinates of the tiling scheme.
  • {eastProjected}: The Eastern edge of the tile in projected coordinates of the tiling scheme.
  • {northProjected}: The Northern edge of the tile in projected coordinates of the tiling scheme.
  • {width}: The width of each tile in pixels.
  • {height}: The height of each tile in pixels.
pickFeaturesUrl Resource | String <optional>
用于选择功能的URL模板。如果未指定此属性, UrlTemplateImageryProvider#pickFeatures将立即返回undefined,表示否 选择的功能。URL模板支持url支持的所有关键字 参数,加上以下内容:
  • {i}: The pixel column (horizontal coordinate) of the picked position, where the Westernmost pixel is 0.
  • {j}: The pixel row (vertical coordinate) of the picked position, where the Northernmost pixel is 0.
  • {reverseI}: The pixel column (horizontal coordinate) of the picked position, where the Easternmost pixel is 0.
  • {reverseJ}: The pixel row (vertical coordinate) of the picked position, where the Southernmost pixel is 0.
  • {longitudeDegrees}: The longitude of the picked position in degrees.
  • {latitudeDegrees}: The latitude of the picked position in degrees.
  • {longitudeProjected}: The longitude of the picked position in the projected coordinates of the tiling scheme.
  • {latitudeProjected}: The latitude of the picked position in the projected coordinates of the tiling scheme.
  • {format}: The format in which to get feature information, as specified in the GetFeatureInfoFormat.
urlSchemeZeroPadding Object <optional>
获取每个平铺坐标的URL方案零填充。格式为“000”,其中 每个坐标将在左侧填充零,以匹配传递的零字符串的宽度。e、 g.设置: urlSchemeZeroPadding:{x}':'0000'} 将导致值为12的“x”返回生成的URL中{x}的字符串“0012”。 如果传递的对象具有以下关键字:
  • {z}: The zero padding for the level of the tile in the tiling scheme.
  • {x}: The zero padding for the tile X coordinate in the tiling scheme.
  • {y}: The zero padding for the the tile Y coordinate in the tiling scheme.
  • {reverseX}: The zero padding for the tile reverseX coordinate in the tiling scheme.
  • {reverseY}: The zero padding for the tile reverseY coordinate in the tiling scheme.
  • {reverseZ}: The zero padding for the reverseZ coordinate of the tile in the tiling scheme.
subdomains String | Array.<String> <optional>
'abc' URL模板中用于{s}占位符的子域。 如果此参数是单个字符串,则字符串中的每个字符都是子域。如果是的话 一个数组,数组中的每个元素都是一个子域。
credit Credit | String <optional>
'' 显示在画布上的数据源的贷方。
minimumLevel Number <optional>
0 提供程序支持的图像的最低细节级别。指定时请小心 这意味着最小级别的瓷砖数量很小,例如4个或更少。可能会有更大的数字 导致渲染问题。
maximumLevel Number <optional>
图像提供商支持的最大细节级别,如果没有限制,则未定义。
rectangle Rectangle <optional>
Rectangle.MAX_VALUE 图像覆盖的矩形,以弧度表示。
tilingScheme TilingScheme <optional>
WebMercatorTilingScheme 平铺方案指定如何 表面碎成了瓦片。如果未提供此参数,则WebMercatorTilingScheme 被使用。
ellipsoid Ellipsoid <optional>
椭球体。如果指定了平铺方案, 忽略此参数,而是使用平铺方案的椭球体。如果两者都不是 参数,则使用WGS84椭球体。
tileWidth Number <optional>
256 图像平铺的像素宽度。
tileHeight Number <optional>
256 图像平铺的像素高度。
hasAlphaChannel Boolean <optional>
true 如果此图像提供程序提供的图像 包含alpha通道;否则为false。如果此属性为false,则为alpha通道,如果 现在,将被忽略。如果此属性为true,则任何没有alpha通道的图像都将 就像他们的alpha到处都是1.0一样。当此属性为false时,内存使用率 而且纹理上传时间可能会减少。
getFeatureInfoFormats Array.<GetFeatureInfoFormat> <optional>
在 调用UrlTemplateImageryProvider#pickFeatures时的特定位置。如果这个 参数未指定,功能拾取被禁用。
enablePickFeatures Boolean <optional>
true 如果为真,UrlTemplateImageryProvider#pickFeatures将 请求pickFeaturesUrl并尝试解释响应中包含的功能。如果是假的, UrlTemplateImageryProvider#pickFeatures将立即返回未定义(表示不可拾取 功能)而不与服务器通信。如果知道数据,请将此属性设置为false 源不支持拾取功能,或者您不希望此提供程序的功能可拾取。注意 通过修改UriTemplateImageryProvider#enablePickFeatures 财产。
customTags Object <optional>
允许替换URL模板中的自定义关键字。对象必须以字符串作为键,函数作为值。