添加点

Apr 25, 2017

添加单点

addPoint(point,options)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var point = {
attributes: {
ID: '01',
QLDM: 'Y236360922L0050',
QLMC: '柏木桥',
LXBM: 'Y236360922',
LXMC: '赤兴至排江',
QLZXZH: '7.4650000000',
PYZH: '0.0000000000',
QLQC: '23.0000000000',
QMQK: '3.5000000000',
ASYNXFLDM: '1.0000000000',
XZQHBM: '360922'
},
geometry: 'POINT (115.92466595234826 27.428038204473552)',
geometryType: 'Point'
}
function addPoint () {
Maps.addPoint(point, {
layerName: 'test'
})
}

添加多点

addPoints(points,options)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var points = [{
attributes: {
ID: '01',
QLDM: 'Y236360922L0050',
QLMC: '柏木桥',
LXBM: 'Y236360922',
LXMC: '赤兴至排江',
QLZXZH: '7.4650000000',
PYZH: '0.0000000000',
QLQC: '23.0000000000',
QMQK: '3.5000000000',
ASYNXFLDM: '1.0000000000',
XZQHBM: '360922'
},
geometry: 'POINT (115.92466595234826 27.428038204473552)',
geometryType: 'Point'
}]
function addPoints () {
Maps.addPoints(points, {
layerName: 'test'
})
}

事件

通过id移除点

removePointById(id)

通过layerName移除图层

removeFeatureByLayerName(layerName)