I have a polygon. I have a point. I want to know if the point is inside the polygon.
rings == [[[lat, lng],[lat, lng]...]]
I've also tried: rings == [[lat, lng],[lat, lng],...]
My Polygon is created like: var poly = new Polygon({ rings, spatialReference: { wkid: 4326 } });
My Point is created like: var pointy = new Point({ latitude, longitude, spatialReference: { wkid: 4326 } });
poly.contains(pointy) always returns false. What am I doing wrong?
Solved! Go to Solution.
If the point exists on one of the vertices or along the edge of the polygon, then contains will return false, since it is not fully contained. You can try using intersects in the geometry engine to see if that will give you a better answer.
Here is a demo.
If the point exists on one of the vertices or along the edge of the polygon, then contains will return false, since it is not fully contained. You can try using intersects in the geometry engine to see if that will give you a better answer.
Here is a demo.