I can currently identify if a polygon is invalid through wps as per below code. What I want to know is how to remove the last sketch polygon if it returns invalid?

To give you an idea, here is the code that is run on "sketchcomplete".

    sketchcomplete: function (e) {
    var poly = e.feature.geometry;//var of sketch geom

    //check if geom valid through wps
    server: 'local', //from server address
    process: 'JTS:isValid', //wps function
    inputs: {
    geom: poly  //geom input for testing if valid
    success: function(outputs) { 
    //on completion of testing check if false = invalid   geom
    $('#noti').append("Invalid Polygon").show(1000);
    $('#noti').css("color", "red");

1 Answer 1


Sorry, solved my own question again. Seems to happen every time I make the decision to post. Anyway, adding this line of code below the draw.deactivate(); solved the problem.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.