antv-l7/stories/layerbuild/components/PointsText.tsx

61 lines
1.1 KiB
TypeScript

// @ts-nocheck
// @ts-ignore
import { Scene, Source } from '@antv/l7';
import { PointLayer } from '@antv/l7-layers';
import { GaodeMap } from '@antv/l7-maps';
import * as React from 'react';
export default class Demo extends React.Component {
public async componentDidMount() {
const scene = new Scene({
id: 'map',
map: new GaodeMap({
center: [110.19382669582967, 30.258134],
pitch: 0,
zoom: 2,
}),
});
const layer = new PointLayer()
.source(
[
{
lng: 120,
lat: 30,
t: 'text1',
},
],
{
parser: {
type: 'json',
x: 'lng',
y: 'lat',
},
},
)
.size(15)
.color('#f00')
.shape('t', 'text')
.active(true);
scene.on('loaded', () => {
scene.addLayer(layer);
});
}
public render() {
return (
<div
id="map"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
></div>
);
}
}