Is there an API available for determining if a point lies inside a polygon geometry determined by a ring?
To do so for a rectangle is simple, but for a ring of points which determines a polygon, what is the best way?
Thanks.
I use this to see in my app if a point is in City Limits (a polygon)
yakimaCL = new esri.layers.FeatureLayer("http://gis.yakimawa.gov/arcgis101/rest/services/General/YakimaLayers/MapServer/9", {
mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
outFields: ["*"],
opacity: .4
});
//the point
var pt = esri.geometry.geographicToWebMercator(new esri.geometry.Point(candidate.location.x.toFixed(6),candidate.location.y.toFixed(6)));
// Check to see if the point is in the City Limits
var isYakima = yakimaCL.graphics[0].geometry.contains(pt);
Randy's approach of using geometry.contains is a great one. Here's another option that uses the Geometry Service.
Hi Edward,
You could create a Polygon from the points XY coordinates, and then use the Polygon to determine if it contains the point.