피쳐 추가
async function add() {
const features = await gwsJS.getLayerFeatures('kgisEditor_LOCAL.xml', 'fd_pole.loc')
const new_feature = features[0]
const fid = 137126
new_feature.setId(fid)
new_feature.set('gid', fid)
new_feature.set('mesh_no', '5655T999') // 새로운 고유번호 부여
console.log(new_feature)
await gwsJS.addLayerFeatures('kgisEditor_LOCAL.xml', 'fd_pole.loc', [new_feature])
const added = await gwsJS.getLayerFeatures('kgisEditor_LOCAL.xml', 'fd_pole.loc')
}
피쳐 편집
async function update() {
const features = await gwsJS.getLayerFeatures('kgisEditor_LOCAL.xml', 'fd_pole.loc')
const new_feature = _.find(features, (f) => f.getId() === '82013')
await gwsJS.updateLayerFeatures('kgisEditor_LOCAL.xml', 'fd_pole.loc', [new_feature])
const updated = await gwsJS.getLayerFeatures('kgisEditor_LOCAL.xml', 'fd_pole.loc')
expect(updated).toBeArray()
}
피쳐 삭제
async function remove() {
const features = await gwsJS.getLayerFeatures('kgisEditor_LOCAL.xml', 'fd_pole.loc')
const new_features = _.filter(features, (f) => Number(f.getId()) >= 137122)
await gwsJS.removeLayerFeatures('kgisEditor_LOCAL.xml', 'fd_pole.loc', new_features)
const removed = await gwsJS.getLayerFeatures('kgisEditor_LOCAL.xml', 'fd_pole.loc')
}