0

I'm having the case where I want to add a modify interaction over GeoJSON (loaded from URL) that is created previously, while changing the existing geometry without adding new vertices, but I get new vertices created where the original geometry not changed (images below, unfortunately gif is large), the first image shows the original geometry

enter image description here

the second image shows what happen after I grab some end and move it.

enter image description here

this is the code I'm using:

fetch("url").then(res=>res.json()).then(
            (data)=>{
                let vectorSource = new ol.source.Vector({
                    features:new ol.format.GeoJSON().readFeatures(data)
                })
                let vectorLayer =  new ol.layer.Vector({
                    source: vectorSource
                })
                
             
                let modification_interaction = new ol.interaction.Modify({
                    source: vectorSource,
                    insertVertexCondition: false
                })
             
                this.olmap.map.addInteraction(modification_interaction)
                this.olmap.map.addLayer(vectorLayer)
                }

OpenLayers version is v6.4.3,

2
  • The condition should be a function. If using full build syntax you need ol.events.condition.never, or function(){return false}
    – Mike
    Commented Nov 23, 2022 at 14:35
  • thank you Mike, i guess i've found the problem, pretty much it seems the fetch is called multiple times which caused multiple geometreis stack on top of each other at the same place Commented Nov 23, 2022 at 14:40

1 Answer 1

0

for my specific case, it seems the fetch request is called multiple times which lead to geometries stack on top of each other, had to prevent that and now i can modify the features without problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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