Hello, 

I am trying to use the containsPoint function to check to see whether a
point is within a polygon.  Here is a snippet from my code: 

 // create a polygon feature from a linear ring of points 
                        var pointList = []; 
                        var polyPoints = polygon.split(","); 
                        for (var i in polyPoints) { 
                                var pLonLat = polyPoints[i].split(" "); 
                                var newPoint = new
OpenLayers.Geometry.Point(pLonLat[0], pLonLat[1]); 
                                pointList.push(newPoint); 
                        } 

                        var linearRing = new
OpenLayers.Geometry.LinearRing(pointList); 
                        var warnPoly = new OpenLayers.Feature.Vector(new
OpenLayers.Geometry.Polygon([linearRing])); 

 var checkPoint  = new OpenLayers.Geometry.Point(x, y); 
                                isIn = warnPoly.containsPoint(checkPoint); 

Unfortunately I get an error stating that containsPoint is not a function.
I've also tried intersects with no success either. 

bw
 
_________________________________________________
Brian Walawender
Technique Development Meteorologist
Scientific Services Division - Central Region Headquarters
816-268-3114 - Office
816-805-6497 - Cell
 
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to