提供由 OpenStreetMap 或其他 Slippy 切片提供商托管的切片图像的图像提供商。默认 url 连接到 OpenStreetMap 的志愿者运行的服务器,因此您必须符合他们的要求 An imagery provider that provides tiled imagery hosted by OpenStreetMap or another provider of Slippy tiles. The default url connects to OpenStreetMap's volunteer-run servers, so you must conform to their
Tile Usage Policy.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
options |
OpenStreetMapImageryProvider.ConstructorOptions | 描述初始化选项的对象 Object describing initialization options |
抛出: Throws:
-
DeveloperError :矩形和minimumLevel 表示最低级别有超过4 个图块。不支持最低级别超过四个图块的图像提供程序。 : The rectangle and minimumLevel indicate that there are more than four tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.
示例: Example:
const osm = new Cesium.OpenStreetMapImageryProvider({
url : 'https://tile.openstreetmap.org/'
});
另见: See:
继承 Extends
成员 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.
- 继承自: Inherited From:
- 默认值: Default Value:
undefined
获取或设置一个值,该值指示是否启用特征拾取。如果属实的话, 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 将立即返回未定义(表示没有可选择的功能),而不与服务器通信。如果您知道您的数据源不支持选择功能或者您不希望该提供程序的功能可供选择,请将此属性设置为 false。 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.
- 继承自: Inherited From:
- 默认值: 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.
- 继承自: Inherited From:
获取一个值,该值指示此图像提供程序提供的图像是否包含 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.
- 继承自: Inherited From:
- 默认值: Default Value:
true
获取可以请求的最大详细级别,如果没有限制则为未定义。 Gets the maximum level-of-detail that can be requested, or undefined if there is no limit.
- 继承自: Inherited From:
- 默认值: Default Value:
undefined
获取可以请求的最低详细程度。 Gets the minimum level-of-detail that can be requested.
- 继承自: Inherited From:
- 默认值: Default Value:
0
获取用于选择要素的 URL 模板。如果未指定此属性, Gets the URL template to use to use to pick features. If this property is not specified,
UrlTemplateImageryProvider#pickFeatures 将立即返回未定义,表示没有选择任何功能。 URL 模板支持所有受支持的关键字 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:
{i}:拾取位置的像素列(水平坐标),最西边的像素为0。 : The pixel column (horizontal coordinate) of the picked position, where the Westernmost pixel is 0.{j}:拾取位置的像素行(垂直坐标),其中最北像素为 0。 : The pixel row (vertical coordinate) of the picked position, where the Northernmost pixel is 0.{reverseI}:拾取位置的像素列(水平坐标),其中最东边的像素为0。 : The pixel column (horizontal coordinate) of the picked position, where the Easternmost pixel is 0.{reverseJ}:拾取位置的像素行(垂直坐标),其中最南端的像素为 0。 : 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 theGetFeatureInfoFormat.
- 继承自: Inherited From:
readonly proxy : Proxy
获取此提供者使用的代理。 Gets the proxy used by this provider.
- 继承自: Inherited From:
- 默认值: Default Value:
undefined
readonly rectangle : Rectangle
获取此实例提供的图像的矩形(以弧度为单位)。 Gets the rectangle, in radians, of the imagery provided by this instance.
- 继承自: Inherited From:
- 默认值: Default Value:
tilingScheme.rectangle
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.
- 继承自: Inherited From:
- 默认值: Default Value:
undefined
获取每个图块的高度(以像素为单位)。 Gets the height of each tile, in pixels.
- 继承自: Inherited From:
- 默认值: Default Value:
256
获取每个图块的宽度(以像素为单位)。 Gets the width of each tile, in pixels.
- 继承自: Inherited From:
- 默认值: Default Value:
256
readonly tilingScheme : TilingScheme
获取此提供程序使用的切片方案。 Gets the tiling scheme used by this provider.
- 继承自: Inherited From:
- 默认值: Default Value:
new WebMercatorTilingScheme()
获取用于请求图块的 URL 模板。它有以下关键词: Gets the URL template to use to request tiles. It has the following keywords:
-
{z}: The level of the tile in the tiling scheme. Level zero is the root of the quadtree pyramid. -
{x}:切片方案中切片的 X 坐标,其中 0 是最西边的切片。 : The tile X coordinate in the tiling scheme, where 0 is the Westernmost tile. -
{y}:切片方案中切片的 Y 坐标,其中 0 是最北的切片。 : 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}:切片方案中图块的 X 坐标,其中 0 是最东边的图块。 : The tile X coordinate in the tiling scheme, where 0 is the Easternmost tile. -
{reverseY}:切片方案中切片的 Y 坐标,其中 0 是最南端的切片。 : The tile Y coordinate in the tiling scheme, where 0 is the Southernmost tile. -
{reverseZ}:切片方案中切片的级别,其中级别 0 是四叉树金字塔的最大级别。为了使用reverseZ,必须定义maximumLevel。 : 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.
- 继承自: Inherited From:
获取每个图块坐标的 URL 方案零填充。格式为“000”,其中每个坐标将在左侧填充零,以匹配传递的零字符串的宽度。例如设置: urlSchemeZeroPadding: { '{x}': '0000'} 将导致 'x' 值 12 在生成的 URL 中为 {x} 返回字符串 '0012'。它有以下关键词: 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:
-
{z}: The zero padding for the level of the tile in the tiling scheme. -
{x}:切片方案中切片 X 坐标的零填充。 : The zero padding for the tile X coordinate in the tiling scheme. -
{y}:切片方案中切片 Y 坐标的零填充。 : The zero padding for the the tile Y coordinate in the tiling scheme. -
{reverseX}:切片方案中切片反向X 坐标的零填充。 : The zero padding for the tile reverseX coordinate in the tiling scheme. -
{reverseY}:切片方案中切片反向Y 坐标的零填充。 : 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.
- 继承自: Inherited From:
方法 Methods
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.
- 继承自: Inherited From:
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. It may also be undefined if picking is not supported.
- 继承自: Inherited From:
requestImage(x, y, level, request) → Promise.<ImageryTypes>|undefined
| 名称 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.
- 继承自: Inherited From:
类型定义 Type Definitions
OpenStreetMapImageryProvider 构造函数的初始化选项 Initialization options for the OpenStreetMapImageryProvider constructor
属性: Properties:
| 名称 Name | 类型 Type | Attributes | 默认值 Default | 说明 Description |
|---|---|---|---|---|
url |
string |
<可选> <optional> |
'https://tile.openstreetmap.org' | OpenStreetMap 服务器 URL。 The OpenStreetMap server url. |
fileExtension |
string |
<可选> <optional> |
'png' | 服务器上图像的文件扩展名。 The file extension for images on the server. |
retinaTiles |
boolean |
<可选> <optional> |
false | 如果为 true,则为视网膜显示请求 2 倍分辨率的图块。 When true, request tiles at the 2x resolution for retina displays. |
rectangle |
Rectangle |
<可选> <optional> |
Rectangle.MAX_VALUE | 图层的矩形。 The rectangle of the layer. |
minimumLevel |
number |
<可选> <optional> |
0 | 图像提供商支持的最低细节级别。 The minimum level-of-detail supported by the imagery provider. |
maximumLevel |
number |
<可选> <optional> |
图像提供者支持的最大细节级别,如果没有限制则未定义。 The maximum level-of-detail supported by the imagery provider, or undefined if there is no limit. | |
ellipsoid |
Ellipsoid |
<可选> <optional> |
椭球体。如果未指定,则使用 WGS84 椭球。 The ellipsoid. If not specified, the WGS84 ellipsoid is used. | |
credit |
Credit | string |
<可选> <optional> |
“MapQuest、开放街道地图和贡献者,CC-BY-SA” 'MapQuest, Open Street Map and contributors, CC-BY-SA' | 数据源的来源,显示在画布上。 A credit for the data source, which is displayed on the canvas. |
