@deck.gl-社区/叶子
此模块允许 传单 用作一种 甲板.gl (英语) 基础图.
更确切地说,它提供了一个叶片自定义层来包裹一个甲板.gl渲染器,使甲板.gl能够使地层与叶片基图同步.
安装
npm install deck.gl @deck.gl-community/leaflet leaflet
使用量
import {DeckOverlay} from '@deck.gl-community/leaflet';
import {MapView} from '@deck.gl/core';
import {GeoJsonLayer, ArcLayer} from '@deck.gl/layers';
import * as L from 'leaflet';
import 'leaflet/dist/leaflet.css';
// source: Natural Earth http://www.naturalearthdata.com/ via geojson.xyz
const AIR_PORTS =
'https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_10m_airports.geojson';
// Create map
const map = L.map(document.getElementById('map'), {
center: [51.47, 0.45],
zoom: 4,
});
L.tileLayer('https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/BlueMarble_ShadedRelief_Bathymetry/default/GoogleMapsCompatible_Level8/{z}/{y}/{x}.jpeg', {
maxZoom: 22,
maxNativeZoom: 8,
attribution: 'Imagery courtesy NASA GIBS',
}).addTo(map);
// Add deck.gl overlay
const deckOverlay = new DeckOverlay({
views: [
new MapView({ repeat: true }),
],
layers: [
new GeoJsonLayer({
id: 'airports',
data: AIR_PORTS,
// Styles
filled: true,
pointRadiusMinPixels: 2,
pointRadiusScale: 2000,
getPointRadius: (f) => 11 - f.properties.scalerank,
getFillColor: [200, 0, 80, 180],
// Interactive props
pickable: true,
autoHighlight: true,
onClick: (info) =>
// eslint-disable-next-line
info.object && alert(`${info.object.properties.name} (${info.object.properties.abbrev})`)
}),
new ArcLayer({
id: 'arcs',
data: AIR_PORTS,
dataTransform: (d: any) => d.features.filter((f) => f.properties.scalerank < 4),
// Styles
getSourcePosition: (f) => [-0.4531566, 51.4709959], // London
getTargetPosition: (f) => f.geometry.coordinates,
getSourceColor: [0, 128, 200],
getTargetColor: [200, 0, 80],
getWidth: 1
})
],
getTooltip: (info) => info.object && info.object.properties.name
});
map.addLayer(deckOverlay);
API 参考
笼盖
执行 莱尔。 。 。 .
const deckOverlay = new DeckOverlay({
views: [
new MapView({ repeat: true }),
],
layers: [...],
});
map.addLayer(deckOverlay);
构造器接受传递到 地标 建筑师。 见 限制 详细情况见下文.
以下内容: 凹槽方法 可以从 a 直接调用 DeckOverlay 实例:
deckOverlay.setPropsdeckOverlay.pickObjectdeckOverlay.pickMultipleObjectsdeckOverlay.pickObjects
支持的特征和限制
支持的 deck.gl 特性 :
- 层
- 效果
- 自动突出显示
- 属性过渡
onHover财务报告和审定财务报表onClick调用- 工具提示
不支持的特性 :
- 倾斜
- 多种观点
- 主计长
- 反应整合
- 手势事件召回(如.
onDrag*(中文(简体) )