Class: GraticuleLayer

GraticuleLayer

经纬网类。

new GraticuleLayer(options)

Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/mapboxgl/iclient-mapboxgl.js"></script>
<script>
  new mapboxgl.supermap.GraticuleLayer(options);
  
</script>

// ES6 Import
import { GraticuleLayer } from '@supermapgis/iclient-mapboxgl';

new GraticuleLayer(options);

mapboxgl/overlay/GraticuleLayer.js, line 15
Name Type Description
options Object

参数。

Name Type Default Description
layerID string 可选

图层 ID。默认使用 CommonUtil.createUniqueID("graticuleLayer_") 创建图层 ID。

visible boolean true 可选

是否显示经纬网。

showLabel boolean true 可选

是否显示标签。

opacity number 1 可选

画布不透明度。

interval number | function 10 可选

经纬度的间隔(以度为单位),可以是数字,也可以是函数,参数是map。

extent mapboxgl.LngLatBounds 可选

经纬网渲染的边界范围([minx, miny, maxx, maxy]),不传为整个地图范围。

minZoom number 可选

最小视图缩放级别(不包括此级别),在该级别之上,该层将可见。

maxZoom number 可选

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

lngLabelFormatter function null 可选

经度标签转换函数。

latLabelFormatter function null 可选

纬度标签转换函数。

lngLabelStyle GraticuleLayer.LabelStyle 可选

经度标签样式。

latLabelStyle GraticuleLayer.LabelStyle 可选

纬度标签样式。

strokeStyle GraticuleLayer.StrokeStyle 可选

绘制经纬线的样式。

Version:
  • 10.1.1

Methods

setExtent(extent)

mapboxgl/overlay/GraticuleLayer.js, line 194

设置经纬网渲染的边界范围。

Name Type Description
extent mapboxgl.LngLatBounds

经纬网渲染的边界范围。

setIntervals(interval)

mapboxgl/overlay/GraticuleLayer.js, line 245

设置经纬度的间隔(以度为单位)。

Name Type Description
interval number | function

经纬度的间隔(以度为单位),可以是数字,也可以是函数,参数是map。

setLatLabelStyle(labelStyle)

mapboxgl/overlay/GraticuleLayer.js, line 235

设置纬度标签样式。

Name Type Description
labelStyle GraticuleLayer.LabelStyle

标签样式。

setLngLabelStyle(labelStyle)

mapboxgl/overlay/GraticuleLayer.js, line 225

设置经度标签样式。

Name Type Description
labelStyle GraticuleLayer.LabelStyle

标签样式。

setMaxZoom(maxZoom)

mapboxgl/overlay/GraticuleLayer.js, line 174

该图层可见的最大视图缩放级别。

Name Type Description
maxZoom number

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

setMinZoom(minZoom)

mapboxgl/overlay/GraticuleLayer.js, line 164

设置最小视图缩放级别。

Name Type Description
minZoom number

最小视图缩放级别(不包括此级别),在该级别之上,该层将可见。

setShowLabel(showLabel)

mapboxgl/overlay/GraticuleLayer.js, line 184

设置显示标签。

Name Type Description
showLabel boolean

是否显示标签。

setStrokeStyle(strokeStyle)

mapboxgl/overlay/GraticuleLayer.js, line 206

设置经纬线样式。

Name Type Description
strokeStyle GraticuleLayer.StrokeStyle

经纬线样式。

setVisibility(visible)

mapboxgl/overlay/GraticuleLayer.js, line 143

设置可见性。

Name Type Description
visible boolean

是否可见。

Type Definitions

LabelStyleObject

标签样式。

Properties:
Name Type Default Description
textFont Array.<string> ['Calibri','sans-serif'] 可选

字体样式。

textSize string '12px' 可选

字体大小。

textColor string 'rgba(0,0,0,1)' 可选

字体颜色。

textHaloColor string 'rgba(255,255,255,1)' 可选

描边颜色。

textHaloWidth number 1 可选

描边宽度。

textAnchor string 'bottom' 可选

字体基线: "center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"。

StrokeStyleObject

线样式。

Properties:
Name Type Default Description
lineColor string 'red' 可选

线颜色。

lineCap string 'round' 可选

线端点风格:butt, round, square。

lineJoin string round 可选

线连接样式:bevel, round, miter。

lindDasharray Array.<number> [0.5,4] 可选

虚线样式。

lineWidth number 1 可选

线宽。