1

I have some WFS layers in OpenLayers, containing Polygons. I try to make a tool to split these polygnos and save them to db.

//The layer which I want spliting work on
var contract_layer = map.getLayersByName("contracts");
//The spliting control
var split_control = new OpenLayers.Control.Split({
       layer: contract_layer,
       listeners: {
           'beforesplit' : function(){
               alert("before");
           }
       }
}); 

and then I add this control to my map and make it active:

toolbarItems.push(new GeoExt.Action({
       control: split_control,
       map: map,
       toggleGroup: 'map'
   }));

   map.addControl(split_control);
   split_control.activate();

And now when I chose the tool, I can draw a line which ends with double-click, but that's it. nothing else.Nothing splits and nothing is sent to geoserver. What do you think I'm missing?

1

I think the split control only works against line features, not polygon features. You will need to post the feature (to be split) and split line to a Web Processing Service, or use the jsts library.

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.