[OpenLayers-Users] Point in polygon

Brad Spencer brad at cubewerx.com.au
Wed Nov 4 00:45:54 EST 2009


Guys, I have created a vector polygon as follows:

 

var parcel01 = new OpenLayers.Geometry.LinearRing(pointList);

polygonFeature = new OpenLayers.Feature.Vector( new
OpenLayers.Geometry.Polygon([parcel01]));

vectorLayer.addFeatures([polygonFeature]);

 

I then am parsing a list of external points to include only those that are
inside the polygon on the map as vector markers.

 

I have tried the following with no success:

 

If (polygonFeature.intersects(new OpenLayers.Geometry.Point(p[0], p[1])))
{// include code.}

and 

If (polygonFeature.containsPoint(new OpenLayers.Geometry.Point(p[0], p[1])))
{// include code.}

 

Where p[0] = x-coords in Sphericalmercator

And p[1] = y-coord in SphericalMercator.

 

The error returned is polygonFeature.intersects is not a function. I can
verify that the polygon is being created.

 

Is there something I am missing here? I am using OL version 2.8.

 

Does anyone have a simple example of point-in-polygon working?

 

Cheers,

 

 

Brad Spencer

General Manager

NuMaps

tel: 02 9481 7024

mob: 0404 841 131

www.numaps.com.au

brad at numaps.com.au

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091104/7e352c7f/attachment.html


More information about the Users mailing list