Module: ol/layer/Graticule

ol/layer/Graticule


Classes

Graticule

Type Definitions

GraticuleLabelDataType{Object}

Properties:
Name Type Description
geom Point

几何对象。

text string

文本。

Options{Object}

Properties:
Name Type Description
className string
(defaults to 'ol-layer')

设置到图层元素的 CSS 类名。

opacity number
(defaults to 1)

不透明度 (0, 1)。

visible boolean
(defaults to true)

可见性。

extent Extent | undefined

图层渲染的边界范围。 图层不会在此范围之外渲染。

zIndex number | undefined

图层渲染的 z-index。在渲染时,图层将按 Z-index 排序,然后按位置排序。当 undefined 时,添加到地图 layers 集合的图层假定 zIndex 为 0,或使用图层 setMap() 方法时为 Infinity

minResolution number | undefined

此图层可见的最小分辨率(含)。

maxResolution number | undefined

此图层可见的最大分辨率(不含)。

minZoom number | undefined

此图层可见的最小视图缩放级别(不含)。

maxZoom number | undefined

此图层可见的最大视图缩放级别(含)。

maxLines number
(defaults to 100)

从地图中心出发的最大经线和纬线数。默认值 100 表示最多显示 200 条经线和 200 条纬线。默认值适用于球面墨卡托等共形投影。如果增加该值,将绘制更多线条,绘制性能会下降。

strokeStyle Stroke | undefined

用于绘制经纬网的描边样式。如果未提供,将使用以下描边:

new Stroke({
  color: 'rgba(0, 0, 0, 0.2)' // a not fully opaque black
});
targetSize number
(defaults to 100)

经纬网单元的目标尺寸(像素)。

showLabels boolean
(defaults to false)

为每条经纬网线渲染带有相应纬度/经度的标签。

lonLabelFormatter function | undefined

经度标签格式化器。此函数以经度为参数调用,应返回表示经度的格式化字符串。默认情况下,标签格式为度、分、秒和半球。

latLabelFormatter function | undefined

纬度标签格式化器。此函数以纬度为参数调用,应返回表示纬度的格式化字符串。默认情况下,标签格式为度、分、秒和半球。

lonLabelPosition number
(defaults to 0)

经度标签在视图范围中的位置比例(0..1)。0 表示视口底部,1 表示顶部。

latLabelPosition number
(defaults to 1)

纬度标签在视图范围中的位置比例(0..1)。0 表示视口左侧,1 表示右侧。

lonLabelStyle 文本 | undefined

经度标签文本样式。如果未提供,将使用以下样式:

new 文本({
  font: '12px Calibri,sans-serif',
  textBaseline: 'bottom',
  fill: new Fill({
    color: 'rgba(0,0,0,1)'
  }),
  stroke: new Stroke({
    color: 'rgba(255,255,255,1)',
    width: 3
  })
});

注意默认的 textBaseline 配置对于将标签放置在视口顶部附近的 lonLabelPosition 配置可能不太适用。

latLabelStyle 文本 | undefined

纬度标签文本样式。如果未提供,将使用以下样式:

new 文本({
  font: '12px Calibri,sans-serif',
  textAlign: 'end',
  fill: new Fill({
    color: 'rgba(0,0,0,1)'
  }),
  stroke: Stroke({
    color: 'rgba(255,255,255,1)',
    width: 3
  })
});

注意默认的 textAlign 配置对于将标签放置在视口左侧附近的 latLabelPosition 配置可能不太适用。

intervals Array.<number>
(defaults to [90, 45, 30, 20, 10, 5, 2, 1, 30/60, 20/60, 10/60, 5/60, 2/60, 1/60, 30/3600, 20/3600, 10/3600, 5/3600, 2/3600, 1/3600])

经纬网的间隔(度)。例如,将经纬网限制为 30 和 10 度间隔:

[30, 10]
wrapX boolean
(defaults to true)

是否水平重复经纬网。

properties 对象。<string, *> | undefined

任意可观察属性。可通过 #get()#set() 访问。