openlayers: error when modifying polygon

I just run into the following error while playing around, editing a simple polygon.

Unfortunately I have no idea what triggered the bug, I was just (double) clicking around for testing.

The polygon was created simply by a draw interaction.

3.20.1 / Chrome / OS X 10.11.6

Assertion failed: uid (%s) of value (%s) does not exist 137 Objectdepth: Array[1]feature: ol.Featuregeometry: ol.geom.Polygonindex: 4ol_uid: 137segment: Array[2]__proto__: Object
ol.structs.RBush.update @ ol-debug.js:34819
ol.interaction.Modify.handleUpEvent_ @ ol-debug.js:69494
ol.interaction.Pointer.handleEvent @ ol-debug.js:18627
ol.interaction.Modify.handleEvent @ ol-debug.js:69539
ol.Map.handleMapBrowserEvent @ ol-debug.js:41784
boundListener @ ol-debug.js:3441
ol.events.EventTarget.dispatchEvent @ ol-debug.js:3859
ol.MapBrowserEventHandler.handlePointerUp_ @ ol-debug.js:17027
boundListener @ ol-debug.js:3441
ol.events.EventTarget.dispatchEvent @ ol-debug.js:3859
ol.pointer.PointerEventHandler.fireNativeEvent @ ol-debug.js:16802
ol.pointer.NativeSource.pointerUp @ ol-debug.js:15645
ol.pointer.PointerEventHandler.eventHandler_ @ ol-debug.js:16591
boundListener @ ol-debug.js:3441

Uncaught TypeError: Cannot read property 'minX' of undefined
    at ol.structs.RBush.update (ol-debug.js:34823)
    at ol.interaction.Modify.handleUpEvent_ (ol-debug.js:69494)
    at ol.interaction.Modify.ol.interaction.Pointer.handleEvent (ol-debug.js:18627)
    at ol.interaction.Modify.handleEvent (ol-debug.js:69539)
    at ol.Map.handleMapBrowserEvent (ol-debug.js:41784)
    at ol.MapBrowserEventHandler.boundListener (ol-debug.js:3441)
    at ol.MapBrowserEventHandler.ol.events.EventTarget.dispatchEvent (ol-debug.js:3859)
    at ol.MapBrowserEventHandler.handlePointerUp_ (ol-debug.js:17027)
    at ol.pointer.PointerEventHandler.boundListener (ol-debug.js:3441)
    at ol.pointer.PointerEventHandler.ol.events.EventTarget.dispatchEvent (ol-debug.js:3859)
ol.structs.RBush.update @ ol-debug.js:34823
ol.interaction.Modify.handleUpEvent_ @ ol-debug.js:69494
ol.interaction.Pointer.handleEvent @ ol-debug.js:18627
ol.interaction.Modify.handleEvent @ ol-debug.js:69539
ol.Map.handleMapBrowserEvent @ ol-debug.js:41784
boundListener @ ol-debug.js:3441
ol.events.EventTarget.dispatchEvent @ ol-debug.js:3859
ol.MapBrowserEventHandler.handlePointerUp_ @ ol-debug.js:17027
boundListener @ ol-debug.js:3441
ol.events.EventTarget.dispatchEvent @ ol-debug.js:3859
ol.pointer.PointerEventHandler.fireNativeEvent @ ol-debug.js:16802
ol.pointer.NativeSource.pointerUp @ ol-debug.js:15645
ol.pointer.PointerEventHandler.eventHandler_ @ ol-debug.js:16591
boundListener @ ol-debug.js:3441

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 29 (11 by maintainers)

Most upvoted comments

Similar issue.

Dodgy hack workaround (side effects not observed but could exist):

In the function “ol.structs.RBush.prototype.update” add the following line

var item = this.items_[ol.getUid(value)]; if (!item) return; // <== added line

And my hack workaround without update OL source file:

// my javascript (ES6) script
import RBush from 'ol/structs/RBush';

const RBushUpdateOrig = RBush.prototype.update;

RBush.prototype.update = function () {
    try {
        RBushUpdateOrig.apply(this, arguments);
    } catch (e) {
        console.warn('RBushUpdateOrig', e);
    }
};

Maybe it helps somebody 😃

Sadly I have not been able to produce a reliable test case as its a fairly flaky bug. I will try to dig into my old code to do so but will be dependent on what the boss man says ^_^

I’m getting similar behavior on v4.6.4 when I add select, modify and draw ‘Polygon’ (or ‘LineString’) interactions simultaneously: var select = new ol.interaction.Select({ wrapX: false }); var modify = new ol.interaction.Modify({ features: select.getFeatures() }); var map = new ol.Map({ interactions: ol.interaction.defaults().extend([select, modify]), … }); … var draw = new ol.interaction.Draw({ source: source, type: ‘Poligon’ }); map.addInteraction(app.draw);

To avoid this I remove select & modify before adding draw.

Looks like someone’s modifying coordinates without calling changed() on the geometry. We’d still need a link to an official example or a working JSFiddle that reveals the issue.