Create Polygon Object from Feature Layer

879
3
Jump to solution
11-15-2016 12:48 PM
deleted-user-gqr_hXrLM2-m
New Contributor II

Hello.,

I am currently trying to create a functionality within a Web GIS application that checks to see if a geocoded point is within a Feature Layer (polygon). I understand that the .contains method is something that can be utilized using the esri/geometry/Polygon class. Having said that, is there a way to create a Polygon object from a Feature Layer? Assuming that the feature layer is a single polygon with no subdivisions. Any help at all would be greatly appreciated. Thank you.

-Jacob

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Jacob,

   If it is a FeatureLayer Object  and only has one feature then you just use FeatureLayer.graphics[0].geometry. You do not even have to have the Map Service as part of the map, if you use a QueryTask to query the map service and return the geometry.

View solution in original post

0 Kudos
3 Replies
deleted-user-gqr_hXrLM2-m
New Contributor II

To be more clear, the operation that I am trying to perform is essentially a 'Point in Polygon' operation. The only thing that I am having trouble with is how I can utilize a map service as the 'Polygon'.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jacob,

   If it is a FeatureLayer Object  and only has one feature then you just use FeatureLayer.graphics[0].geometry. You do not even have to have the Map Service as part of the map, if you use a QueryTask to query the map service and return the geometry.

0 Kudos
deleted-user-gqr_hXrLM2-m
New Contributor II

Okay, great. I will try this. Thanks so much for your help.

0 Kudos