Hello, I'm looking for a little help with a point moving inside and outside of a polygon.  Currently I'm using the following code:
<div>--</div><div><div>for(var i = 0; i &lt; OL.maps[<a href="http://map.id">map.id</a>].map.layers[1].features.length; i++) {</div><div>  </div><div>  if(locationSwitch == false &amp;&amp; OL.maps[<a href="http://map.id">map.id</a>].map.layers[1].features[i].geometry.containsPoint &amp;&amp; OL.maps[<a href="http://map.id">map.id</a>].map.layers[1].features[i].geometry.containsPoint(p)) {</div>
<div>       var yourlocation = OL.maps[<a href="http://map.id">map.id</a>].map.layers[1].features[i].data.node_title;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>   alert(&#39;now youre inside the polygon&#39;);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>   locationSwitchInner = true;</div><div>  }</div><div><div> if(locationSwitchInner == true){</div><div>locationSwitch = true;</div><div>}</div><div>    if(locationSwitch == true &amp;&amp; !OL.maps[<a href="http://map.id">map.id</a>].map.layers[1].features[i].geometry.containsPoint(p)) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>   locationSwitchInner = false;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>   alert(&#39;you are now leaving the polygon&#39;);</div>
<div>  }</div><div>  if(locationSwitchInner == false){</div><div>locationSwitch = false;</div><div>}</div><div> }</div><div>   };</div><div><br></div><div>--------------------------------------</div><div><br></div><div>Basically what I&#39;m doing is tracking a point on a map that contains polygons.  I may not have included all of the code above but the necessary items should be there.  I am displaying an alert when I enter a polygon, which is working just fine.  The code checks my point across (currently) 4 polygons and alerts me when I enter into one.  Once I&#39;m in one, I want to send another alert when I exit the polygon.  However the code above doesn&#39;t work because in the if statement that checks if I&#39;m not in a polygon, it checks all 4 polygons so of course 3 of them will validate because none of the polygons intersect.</div>
<div><br></div><div>I guess my question is this: how can I check if my point is exiting ONLY the polygon that I&#39;m currently in (once I&#39;m in the polygon of course)?  I am thinking that the [i] could be included in the &#39;if&#39; statement looking for the exit point since it&#39;s still inside the &#39;for&#39; statement, however, I&#39;m pretty bad with my for loop understanding.</div>
<div><br></div><div>Any help is greatly appreciated.  Thanks in advance.</div><div><br></div><div>Jesse</div></div></div>