Remove Feature
To remove feature pass callback function to the removeFeature
function.
Callback Function
-
callback- Function to be called back. Response will be passed to this function. It should be handled inside this function.Response structure
-
success-true | false. If value istruethen feature was successfully removed. Iffalsethen it means saving failed. You can checkmessageproperty for the reason of fail. -
message- Additional message about the result of the call.
-
Example
// Initialization of the map
var options = {
tileSettings: {
source: 'xyz',
url: 'https://gomap.az/smoothtiles/maptile.do?lng=az&x={x}&y={y}&z={z}&f=png&dp=0'
},
targetElement: 'map' // Id of the <div> element. Container of the map.
};
GisTools.initializeMap({options: options});
var options = {
userId: '00000000-0000-0000-0000-000000000001',
featureIdList: ['00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002']
};
GisTools.loadFeatures({options: options});
// Adding select interaction
var interactionOptions = {
type: 'select'
};
GisTools.addMapInteraction({options: interactionOptions});
var guideRemoveButton = document.getElementsByClassName('guide-remove-button');
guideRemoveButton[0].addEventListener('click', function () {
GisTools.removeFeature(callBack);
function callBack(response) {
if (response.success === true) { // Success
console.log(response);
alert(response.message);
} else if (response.success === false) { // Fail
console.log(response);
}
}
});