AnsweredAssumed Answered

Polygon isSelfIntersecting

Question asked by a.schaefer-esri-de-esridist on Dec 17, 2013
Latest reply on Dec 17, 2013 by a.schaefer-esri-de-esridist
Hi.

I'm working on a redlining function, where I want to check if the polygon is selfIntersecting. I check the geometry, but it says that it's always self-intersecting, even if it isn't.

The code is really simple. Here are the snippets.

        initDraw: function() {             this._tb = new Draw(this.map);              // I DRAW A POLYGON             this._tb.activate(Draw.POLYGON);              this._tb.on("draw-end", lang.hitch(this, this.addToMap));          },          addToMap: function(evt) {             // some stuff              this._tb.deactivate();              var symbol = new SimpleFillSymbol(config.geometryStyles.geofencePolygon);              // MY GEOMETRY == MY POLYGON             var geometry = evt.geometry;              var graphic = new Graphic(geometry, symbol);             this.geofenceGraphicsLayer.add(graphic);              // MY CHECK. Is always alerting, shouldn't do that. :(             if (geometry.isSelfIntersecting) {                 alert("Is Self Intersecting");             } else {                 // do something...             }         },



This is the polygon as JSON that I send to the console. It's a simple triangle.

{"type":"polygon","rings":[[[2343355.197916185,6843378.9380211625],[2343591.077808191,6843221.286650303],[2343284.7325307247,6843149.029771992],[2343355.197916185,6843378.9380211625]]],"_ring":0,"spatialReference":{"wkid":102100},"_centroid":null,"_extent":{"xmin":2343284.7325307247,"ymin":6843149.029771992,"xmax":2343591.077808191,"ymax":6843378.9380211625,"spatialReference":{"wkid":102100}},"_partwise":null}


What's wrong with the check? Why is "isSelfIntersecting" always true, even if I draw some simple polygon?

The geometry seems to be a Polygon. Firebug says:
- declaredClass: "esri.geometry.Polygon"
- type: "polygon"

Does the method not work on a drawn geometry? Am I missing something?

System: JS-API 3.7, Firefox 25.0 with Firebug.

I appreciate any help. Thanks in advance.
Axel

Outcomes