antv-l7/examples/district/basic/demo/county.js

38 lines
769 B
JavaScript
Raw Normal View History

2020-05-12 17:59:42 +08:00
import { Scene } from '@antv/l7';
import { CountyLayer } from '@antv/l7-district';
import { Mapbox } from '@antv/l7-maps';
2020-11-19 13:47:41 +08:00
const colors = [ '#B8E1FF', '#7DAAFF', '#3D76DD', '#0047A5', '#001D70' ];
2020-05-12 17:59:42 +08:00
const scene = new Scene({
id: 'map',
map: new Mapbox({
center: [ 116.2825, 39.9 ],
pitch: 0,
style: 'blank',
zoom: 3,
minZoom: 3,
maxZoom: 10
})
});
scene.on('loaded', () => {
new CountyLayer(scene, {
data: [],
adcode: [ '110101', '110102', '110106' ],
depth: 3,
label: {
field: 'NAME_CHN'
},
fill: {
2020-05-15 21:07:04 +08:00
color: {
field: 'NAME_CHN',
2020-11-19 10:03:54 +08:00
values: colors
2020-05-15 21:07:04 +08:00
}
2020-05-12 17:59:42 +08:00
},
popup: {
enable: true,
Html: props => {
return `<span>${props.NAME_CHN}</span>`;
}
}
});
});