1

Using the ol.Draw interaction and ol.interaction.Draw.createBox() geometry function we can draw a regular rectangle:

let geomFunction = ol.interaction.Draw.createBox();
let draw = new ol.interaction.Draw({
  source: layer.getSource(),
  type: 'Circle',
  geometryFunction: geomFunction
});

but when using ol.Modify interaction to modify the rectangle I can't ensure the geometry will still a regular rectangle because I can't set a geometry function to the modifying interaction! How can I ensure or preserve the geometry shape when modifying?

  • Any help will be appreciated. If question is not clear enough plz tell me. – abd0991 May 7 '18 at 11:30
  • 1
    Have a look at this. Might help u!!! -->viglino.github.io/ol-ext/examples/interaction/… – pavlos May 7 '18 at 12:25
  • I already looked at this extension, but I want I simple code to apply to my app not an extension. If there is a way to preserve the geometry shape on modifying plz let me know. – abd0991 May 7 '18 at 16:19
  • Any updates ??? – abd0991 May 10 '18 at 12:30
0

I finally used ol-ext, it do the job.

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.