该对象通常不直接实例化,使用 This object is normally not instantiated directly, use
提供由 ArcGIS MapServer 托管的切片图像。默认情况下,使用服务器的预缓存切片(如果可用)。 Provides tiled imagery hosted by an ArcGIS MapServer. By default, the server's pre-cached tiles are used, if available.
ArcGisMapServerImageryProvider.fromBasemapType or ArcGisMapServerImageryProvider.fromUrl.
An ArcGIS Access Token 需要验证对 ArcGIS Image Tile 服务的请求。要访问安全的 ArcGIS 资源,需要创建 ArcGIS 开发人员帐户或 ArcGIS online 帐户,然后实施身份验证方法来获取访问令牌。 is required to authenticate requests to an ArcGIS Image Tile service. To access secure ArcGIS resources, it's required to create an ArcGIS developer account or an ArcGIS online account, then implement an authentication method to obtain an access token.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
options |
ArcGisMapServerImageryProvider.ConstructorOptions | 可选 optional 描述初始化选项的对象 Object describing initialization options |
示例: Examples:
// Set the default access token for accessing ArcGIS Image Tile service
Cesium.ArcGisMapService.defaultAccessToken = "<ArcGIS Access Token>";
// Add a base layer from a default ArcGIS basemap
const viewer = new Cesium.Viewer("cesiumContainer", {
baseLayer: Cesium.ImageryLayer.fromProviderAsync(
Cesium.ArcGisMapServerImageryProvider.fromBasemapType(
Cesium.ArcGisBaseMapType.SATELLITE
)
),
});
// Create an imagery provider from the url directly
const esri = await Cesium.ArcGisMapServerImageryProvider.fromUrl(
"https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer", {
token: "<ArcGIS Access Token>"
});
另见: See:
成员 Members
readonly credit : Credit
获取此图像提供程序处于活动状态时要显示的信用。通常,这用于证明图像的来源。 Gets the credit to display when this imagery provider is active. Typically this is used to credit the source of the imagery.
获取或设置一个值,该值指示是否启用特征拾取。如果属实的话, Gets or sets a value indicating whether feature picking is enabled. If true,
ArcGisMapServerImageryProvider#pickFeatures 将调用 ArcGIS 服务器上的“识别”操作并返回响应中包含的要素。如果是假的, will invoke the "identify" operation on the ArcGIS server and return the features included in the response. If false,
ArcGisMapServerImageryProvider#pickFeatures 将立即返回未定义(表示没有可选择的功能),而不与服务器通信。 will immediately return undefined (indicating no pickable features) without communicating with the server.
-
默认值: Default Value:
true
readonly errorEvent : Event
获取当图像提供程序遇到异步错误时引发的事件。通过订阅该事件,您将收到错误通知,并有可能从中恢复。事件监听器传递一个实例 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.
获取一个值,该值指示此图像提供程序提供的图像是否包含 Alpha 通道。如果此属性为 false,则 Alpha 通道(如果存在)将被忽略。如果此属性为 true,则任何没有 Alpha 通道的图像都将被视为其 Alpha 在任何地方都是 1.0。当此属性为 false 时,内存使用量和纹理上传时间都会减少。 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.
-
默认值: Default Value:
true
获取要显示的以逗号分隔的图层 ID 列表。 Gets the comma-separated list of layer IDs to show.
获取可以请求的最大详细程度。 Gets the maximum level-of-detail that can be requested.
获取可以请求的最低详细程度。 Gets the minimum level-of-detail that can be requested.
readonly proxy : Proxy
获取此提供者使用的代理。 Gets the proxy used by this provider.
readonly rectangle : Rectangle
获取此实例提供的图像的矩形(以弧度为单位)。 Gets the rectangle, in radians, of the imagery provided by this instance.
readonly tileDiscardPolicy : TileDiscardPolicy
获取图块丢弃策略。如果未定义,则丢弃策略负责通过其 shouldDiscardImage 函数过滤掉“丢失”的图块。如果此函数返回未定义,则不会过滤任何图块。 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.
获取每个图块的高度(以像素为单位)。 Gets the height of each tile, in pixels.
获取每个图块的宽度(以像素为单位)。 Gets the width of each tile, in pixels.
readonly tilingScheme : TilingScheme
获取此提供程序使用的切片方案。 Gets the tiling scheme used by this provider.
获取用于通过 ArcGis MapServer 服务进行身份验证的 ArcGIS 令牌。 Gets the ArcGIS token used to authenticate with the ArcGis MapServer service.
获取 ArcGIS MapServer 的 URL。 Gets the URL of the ArcGIS MapServer.
获取一个值,该值指示此影像提供程序是否正在使用来自 ArcGIS MapServer 的预缓存切片。 Gets a value indicating whether this imagery provider is using pre-cached tiles from the ArcGIS MapServer.
-
默认值: Default Value:
true
方法 Methods
static Cesium.ArcGisMapServerImageryProvider.fromBasemapType(style, options) → Promise.<ArcGisMapServerImageryProvider>
创建一个 Creates an
ImageryProvider 它提供来自 ArcGIS 底图的平铺图像。 which provides tiled imagery from an ArcGIS base map.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
style |
ArcGisBaseMapType |
ArcGIS 底图图像的样式。有效选项是 The style of the ArcGIS base map imagery. Valid options are ArcGisBaseMapType.SATELLITE, ArcGisBaseMapType.OCEANS, 和 , and ArcGisBaseMapType.HILLSHADE. |
options |
ArcGisMapServerImageryProvider.ConstructorOptions | 可选 optional 描述初始化选项的对象。 Object describing initialization options. |
返回: Returns:
A promise that resolves to the created ArcGisMapServerImageryProvider.
示例: Examples:
// Set the default access token for accessing ArcGIS Image Tile service
Cesium.ArcGisMapService.defaultAccessToken = "<ArcGIS Access Token>";
// Add a base layer from a default ArcGIS basemap
const provider = await Cesium.ArcGisMapServerImageryProvider.fromBasemapType(
Cesium.ArcGisBaseMapType.SATELLITE);
// Add a base layer from a default ArcGIS Basemap
const viewer = new Cesium.Viewer("cesiumContainer", {
baseLayer: Cesium.ImageryLayer.fromProviderAsync(
Cesium.ArcGisMapServerImageryProvider.fromBasemapType(
Cesium.ArcGisBaseMapType.HILLSHADE, {
token: "<ArcGIS Access Token>"
}
)
),
});
static Cesium.ArcGisMapServerImageryProvider.fromUrl(url, options) → Promise.<ArcGisMapServerImageryProvider>
创建一个 Creates an
ImageryProvider 它提供由 ArcGIS MapServer 托管的切片图像。默认情况下,使用服务器的预缓存切片(如果可用)。 which provides tiled imagery hosted by an ArcGIS MapServer. By default, the server's pre-cached tiles are used, if available.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
url |
Resource | string | ArcGIS MapServer 服务的 URL。 The URL of the ArcGIS MapServer service. |
options |
ArcGisMapServerImageryProvider.ConstructorOptions | 可选 optional 描述初始化选项的对象。 Object describing initialization options. |
返回: Returns:
A promise that resolves to the created ArcGisMapServerImageryProvider.
抛出: Throws:
-
RuntimeError :元数据空间参考指定未知的 WKID : metadata spatial reference specifies an unknown WKID
-
RuntimeError :元数据 fullExtent.spatialReference 指定未知的 WKID : metadata fullExtent.spatialReference specifies an unknown WKID
示例: Example:
const esri = await Cesium.ArcGisMapServerImageryProvider.fromUrl(
"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"
);
getTileCredits(x, y, level) → Array.<Credit>
获取显示给定图块时要显示的积分。 Gets the credits to be displayed when a given tile is displayed.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
x |
number | 平铺 X 坐标。 The tile X coordinate. |
y |
number | 平铺 Y 坐标。 The tile Y coordinate. |
level |
number | 瓷砖水平; The tile level; |
返回: Returns:
显示图块时要显示的制作人员名单。 The credits to be displayed when the tile is displayed.
pickFeatures(x, y, level, longitude, latitude) → Promise.<Array.<ImageryLayerFeatureInfo>>|undefined
/** 异步确定哪些要素(如果有)位于图块内给定的经度和纬度处。 /** Asynchronously determines what features, if any, are located at a given longitude and latitude within a tile.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
x |
number | 平铺 X 坐标。 The tile X coordinate. |
y |
number | 平铺 Y 坐标。 The tile Y coordinate. |
level |
number | 瓷砖级别。 The tile level. |
longitude |
number | 选择要素的经度。 The longitude at which to pick features. |
latitude |
number | 选择特征的纬度。 The latitude at which to pick features. |
返回: Returns:
对所选取功能的承诺将在异步选取完成时解决。解析后的值是一个数组 A promise for the picked features that will resolve when the asynchronous picking completes. The resolved value is an array of
ImageryLayerFeatureInfo
实例。如果在给定位置未找到要素,则数组可能为空。 instances. The array may be empty if no features are found at the given location.
requestImage(x, y, level, request) → Promise.<ImageryTypes>|undefined
请求给定图块的图像。 Requests the image for a given tile.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
x |
number | 平铺 X 坐标。 The tile X coordinate. |
y |
number | 平铺 Y 坐标。 The tile Y coordinate. |
level |
number | 瓷砖级别。 The tile level. |
request |
Request | 可选 optional 请求对象。仅供内部使用。 The request object. Intended for internal use only. |
返回: Returns:
对图像的承诺,该承诺将在图像可用时解析,或者如果对服务器的活动请求太多,则未定义,并且应稍后重试该请求。 A promise for the image that will resolve when the image is available, or undefined if there are too many active requests to the server, and the request should be retried later.
类型定义 Type Definitions
ArcGisMapServerImageryProvider 构造函数的初始化选项 Initialization options for the ArcGisMapServerImageryProvider constructor
属性: Properties:
| 名称 Name | 类型 Type | Attributes | 默认值 Default | 说明 Description |
|---|---|---|---|---|
tileDiscardPolicy |
TileDiscardPolicy |
<可选> <optional> |
确定图块是否无效并应被丢弃的策略。如果未指定该值,则使用默认值 The policy that determines if a tile is invalid and should be discarded. If this value is not specified, a default
DiscardMissingTileImagePolicy 用于平铺地图服务器,并且 is used for tiled map servers, and a
NeverTileDiscardPolicy 用于非切片地图服务器。在前一种情况下,我们在最大图块级别请求图块 0,0 并检查像素 (0,0)、(200,20)、(20,200)、(80,110) 和 (160, 130)。如果所有这些像素都是透明的,则禁用丢弃检查并且不会丢弃任何图块。如果它们中的任何一个具有不透明的颜色,则丢弃在这些像素位置中具有相同值的任何图块。这些默认值的最终结果应该是标准 ArcGIS Server 的正确切片丢弃。为了确保没有瓷砖被丢弃,构建并传递一个 is used for non-tiled map servers. In the former case, we request tile 0,0 at the maximum tile level and check pixels (0,0), (200,20), (20,200), (80,110), and (160, 130). If all of these pixels are transparent, the discard check is disabled and no tiles are discarded. If any of them have a non-transparent color, any tile that has the same values in these pixel locations is discarded. The end result of these defaults should be correct tile discarding for a standard ArcGIS Server. To ensure that no tiles are discarded, construct and pass a NeverTileDiscardPolicy 对于这个参数。 for this parameter. |
|
usePreCachedTilesIfAvailable |
boolean |
<可选> <optional> |
true | 如果为 true,则使用服务器的预缓存切片(如果可用)。仅已弃用的 API 支持导出图块。 If true, the server's pre-cached tiles are used if they are available. Exporting Tiles is only supported with deprecated APIs. |
layers |
string |
<可选> <optional> |
要显示的以逗号分隔的图层列表,如果应显示所有图层,则未定义。 A comma-separated list of the layers to show, or undefined if all layers should be shown. | |
enablePickFeatures |
boolean |
<可选> <optional> |
true | 如果属实的话, If true, ArcGisMapServerImageryProvider#pickFeatures 将调用 MapServer 上的识别服务并返回响应中包含的功能。如果是假的, will invoke the Identify service on the MapServer and return the features included in the response. If false,
ArcGisMapServerImageryProvider#pickFeatures 将立即返回未定义(表示没有可选择的功能),而不与服务器通信。如果您不希望该提供程序的功能可供选择,请将此属性设置为 false。可以通过设置覆盖 will immediately return undefined (indicating no pickable features) without communicating with the server. Set this property to false if you don't want this provider's features to be pickable. Can be overridden by setting the ArcGisMapServerImageryProvider#enablePickFeatures 对象上的属性。 property on the object. |
rectangle |
Rectangle |
<可选> <optional> |
Rectangle.MAX_VALUE | 图层的矩形。访问平铺图层时将忽略此参数。 The rectangle of the layer. This parameter is ignored when accessing a tiled layer. |
tilingScheme |
TilingScheme |
<可选> <optional> |
新的地理切片方案() new GeographicTilingScheme() | 用于将世界划分为图块的切片方案。访问平铺服务器时将忽略此参数。 The tiling scheme to use to divide the world into tiles. This parameter is ignored when accessing a tiled server. |
ellipsoid |
Ellipsoid |
<可选> <optional> |
Ellipsoid.default | 椭球体。如果指定并使用 tilingScheme,则忽略此参数并使用切片方案的椭球体。如果两个参数均未指定,则使用默认椭球体。 The ellipsoid. If the tilingScheme is specified and used, this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither parameter is specified, the default ellipsoid is used. |
credit |
Credit | string |
<可选> <optional> |
数据源的来源,显示在画布上。访问平铺服务器时将忽略此参数。 A credit for the data source, which is displayed on the canvas. This parameter is ignored when accessing a tiled server. | |
tileWidth |
number |
<可选> <optional> |
256 | 每个图块的宽度(以像素为单位)。访问平铺服务器时将忽略此参数。 The width of each tile in pixels. This parameter is ignored when accessing a tiled server. |
tileHeight |
number |
<可选> <optional> |
256 | 每个图块的高度(以像素为单位)。访问平铺服务器时将忽略此参数。 The height of each tile in pixels. This parameter is ignored when accessing a tiled server. |
maximumLevel |
number |
<可选> <optional> |
要请求的最大图块级别,如果没有最大值则未定义。访问平铺服务器时将忽略此参数。 The maximum tile level to request, or undefined if there is no maximum. This parameter is ignored when accessing a tiled server. |
