Bootstrap

mapbox-gl 实现铁路线黑白交替样式

{
			"id": "base-map-tielu",
			"source": "base-veclayers",
			"source-layer": "tielu",
			"type": "line",
			"minzoom": 0,
			"maxzoom": 24,
			"paint": {
				"line-width": 6,
				"line-color": "#ffffff"
			},
			"layout": {
				"line-cap": "square",
				"line-join": "bevel",
				"visibility": "visible"
			}
		},
		{
			"id": "base-map-tielu2",
			"source": "base-veclayers",
			"source-layer": "tielu",
			"type": "line",
			"minzoom": 0,
			"maxzoom": 24,
			"paint": {
				"line-dasharray": [
					1.2,
					2.4
				],
				"line-width": 6,
				"line-color": "#232323"
			},
			"layout": {
				"line-cap": "square",
				"line-join": "bevel",
				"visibility": "visible"
			}
		}

白色线图层放到下面,上面图层放line-dasharray样式的黑色虚线图层。
希望对您有帮助,点点关注不迷路~

;