Merge Feature
To merge features first make them intersect by modifying or dragging them on map. Then multi select them by
holding Shift key and click Merge
button from the toolbar.
To save merged features pass callback function to the mergeFeatures 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 features were successfully merged. You can checkvalueproperty to get thefeature id. Iffalsethen it means merging failed. You can checkmessageproperty for the reason of fail. -
message- Additional message about the result of the call. -
value- It will contain thefeature idif call succeeds. If call fails this property will benull.
-
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 guideMergeButton = document.getElementsByClassName('guide-merge-button');
guideMergeButton[0].addEventListener('click', function () {
GisTools.mergeFeatures(callBack);
function callBack(response) {
if (response.success === true) { // Success
console.log(response);
alert(response.message);
} else if (response.success === false) { // Fail
console.log(response);
}
}
});