Created
June 15, 2019 16:30
-
-
Save dbauszus-glx/530d6c0a5ba3a98f12ffb9163ad610f2 to your computer and use it in GitHub Desktop.
Delete the current feature from vector source and XYZ data source.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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