[OpenLayers-Users] Problem using containsPoint or intersects
Brian Walawender
Brian.Walawender at noaa.gov
Mon Jan 26 12:37:27 EST 2009
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090126/f9a41c7c/attachment.html
More information about the Users
mailing list