Skip to content

Instantly share code, notes, and snippets.

@dbauszus-glx
Created June 15, 2019 16:30
Show Gist options
  • Save dbauszus-glx/530d6c0a5ba3a98f12ffb9163ad610f2 to your computer and use it in GitHub Desktop.
Save dbauszus-glx/530d6c0a5ba3a98f12ffb9163ad610f2 to your computer and use it in GitHub Desktop.
Delete the current feature from vector source and XYZ data source.
btnDelete.onclick = function() {
btnDelete.classList.remove('active');
if (!currentFeature) return;
const xhr = new XMLHttpRequest();
xhr.open('GET', 'https://geolytix.xyz/dev/api/location/edit/delete?locale=GB&layer=Scratch&table=dev.scratch&id=' + currentFeature.getProperties().id);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.responseType = 'json';
xhr.onload = e => {
if (e.target.status !== 200) return;
sourceVector.clear();
clearTileCache();
};
xhr.send();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment