Select to view content in your preferred language

Polygon.contains throws a script timeout error

768
3
06-04-2013 08:37 AM
PriyaRam
Deactivated User
The Polygon.contains method throws a script timeout error for certain polygons . I'm using esri flex viewer 2.5 and please let me know, how i can get around the issue.

for(var p:Number =0; p < _polyResult.rings.length; p++)
{
 var _polygonSingleR:Polygon = new Polygon();
 _polygonSingleR.rings = [];
 _polygonSingleR.rings.push(_polyResult.rings

); _polygonSingleR.spatialReference = _spatialReference;                    for(var q:Number =0; q < _polyResult.rings.length; q++)   {     if(p != q)   {   var _arrMapPoints:Array = _polyResult.rings;                 var _temp:Number = 0;   for(var r:Number =0; r < _arrMapPoints.length; r++) {    var _mapPoint:MapPoint = _arrMapPoints as MapPoint;            if(_polygonSingleR.contains(_mapPoint))    {    _temp++;    }  }                      if(_temp == _arrMapPoints.length)   {         _arrValidatedGaps.push(_polyResult.rings);   }   } } }

Tags (2)
0 Kudos
3 Replies
PriyaRam
Deactivated User
I found, that it is not the polygon.contains method , but rather a long running process, which is causing the flash time out error. Possibly reducing the number of steps will resolve the problem. is there a way to reduce the number of for loops(1st and 2nd ),since it seems redundant only for doing a p!=q  Any help is appreciated.
0 Kudos
GISDev1
Deactivated User
What is the use case here? What is that code block supposed to be checking?
0 Kudos
PriyaRam
Deactivated User
it is supposed to find the gaps between polygons.
0 Kudos