<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Restrict feature layer using a user drawn polygon in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/restrict-feature-layer-using-a-user-drawn-polygon/m-p/625763#M13909</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have the same issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I get the following errror &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Unsupported Query parameters for FeatureCollection"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any advice on how to query a FeatureLayer with a FeatureCollection against a geometry ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
// build the featurelayer
var featureSet:FeatureSet = new FeatureSet(graphicCollection);
var layerDetails:LayerDetails = new LayerDetails();
var featureLayer:FeatureLayer = new FeatureLayer();
featureLayer.featureCollection = new FeatureCollection(featureSet, layerDetails);

//build the query based on a polygon I want to intesect with the features in the featurelayer
var query:Query = new Query();
query.geometry = mypolygon;
query.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
query.outSpatialReference = spatialReference;

//run the query
featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW,new AsyncResponder(onQueryResult2, onQueryFault2));

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 02:40:19 GMT</pubDate>
    <dc:creator>JorgeFiallega</dc:creator>
    <dc:date>2021-12-12T02:40:19Z</dc:date>
    <item>
      <title>Restrict feature layer using a user drawn polygon</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/restrict-feature-layer-using-a-user-drawn-polygon/m-p/625760#M13906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am creating a widget to query a feature layer and display the results on the map.&amp;nbsp; So far I have it filtering data using the definitionExpression when the user clicks the query button on my widget and now I am trying to implement the ability to draw a polygon on the map and when the user presses the query button it will only return points that intersect with the polygon.&amp;nbsp; I can see from the query page of the feature class that setting the input geometry yields the results I want but I cannot figure out how to do this in action script.&amp;nbsp; It seems like there should be some property on the feature layer like tLayer.Geometry but that doesn't seem to work.&amp;nbsp; Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2012 15:13:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/restrict-feature-layer-using-a-user-drawn-polygon/m-p/625760#M13906</guid>
      <dc:creator>JamesBerg</dc:creator>
      <dc:date>2012-07-19T15:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict feature layer using a user drawn polygon</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/restrict-feature-layer-using-a-user-drawn-polygon/m-p/625761#M13907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;jberg,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From what I gather you are attempting to select a series of points from a layer and return them if they are contained by a polygon drawn by a user?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I doubt the following logic will be the most elegant way but my approach would be as follows using points stored in a GraphicsLayer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var polygon:Polygon = new Polygon(); //This would be the user's created polygon.

for(var i:int = 0; i&amp;lt;=graphicsLayer.numGraphics;i++){
&amp;nbsp; if(!polygon.contains(MapPoint((graphicsLayer.graphicsProvider&lt;I&gt; as Graphic).geometry)){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic.visible = false;
&amp;nbsp; }else{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic.visible = true;
&amp;nbsp; };
};
&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:40:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/restrict-feature-layer-using-a-user-drawn-polygon/m-p/625761#M13907</guid>
      <dc:creator>AustinDavis</dc:creator>
      <dc:date>2021-12-12T02:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict feature layer using a user drawn polygon</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/restrict-feature-layer-using-a-user-drawn-polygon/m-p/625762#M13908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Austin thanks for the suggestion.&amp;nbsp; I feel like there has to be a more elegant way.&amp;nbsp; I've tried the following but I am not able to get the points to show on the map and so I don't know if my info popup will work this way.&amp;nbsp; I get results in the feature class in the OnResutls call back but I can't get them to show.&amp;nbsp; The thing that is confusing to me is that there is a input geometry parameter to the REST API that you call but I can't see how to set it the same way that you specify the where clause or definitionExpression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var layerName:String;
if ( configXML )
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; layerName = configXML.layer;
}
else
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; layerName = "Tickets";
}
var ticketLayer:FeatureLayer = map.getLayer(layerName) as FeatureLayer;

var queryTask:QueryTask = new QueryTask(ticketLayer.url);
var queryTickets:Query = new Query();

// geom is the geometry object that the user draws on the map
if ( geom != null )
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; queryTickets.geometry = geom;
&amp;nbsp;&amp;nbsp;&amp;nbsp; queryTickets.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
&amp;nbsp;&amp;nbsp;&amp;nbsp; queryTickets.outSpatialReference = geom.spatialReference;
}
else
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; queryTickets.outSpatialReference = map.spatialReference;
}

var graph:GraphicsLayer = new GraphicsLayer();
graph.name = "testGeo";
map.addLayer(graph);

//ticketLayer.queryFeatures(queryTickets, new AsyncResponder(onResult, onFault));
queryTask.execute(queryTickets, new AsyncResponder(onResult, onFault ));

function onResult(featureSet:FeatureSet, token:XMLList = null):void
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; var tktSym:SimpleMarkerSymbol = new SimpleMarkerSymbol("triangle", 20, 0xFF0000);
&amp;nbsp;&amp;nbsp;&amp;nbsp; graph.symbol = tktSym;
&amp;nbsp;&amp;nbsp;&amp;nbsp; graph.graphicProvider = featureSet.features;
}

function onFault(info:Object, token:Object = null):void
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:40:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/restrict-feature-layer-using-a-user-drawn-polygon/m-p/625762#M13908</guid>
      <dc:creator>JamesBerg</dc:creator>
      <dc:date>2021-12-12T02:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict feature layer using a user drawn polygon</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/restrict-feature-layer-using-a-user-drawn-polygon/m-p/625763#M13909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have the same issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I get the following errror &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Unsupported Query parameters for FeatureCollection"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any advice on how to query a FeatureLayer with a FeatureCollection against a geometry ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
// build the featurelayer
var featureSet:FeatureSet = new FeatureSet(graphicCollection);
var layerDetails:LayerDetails = new LayerDetails();
var featureLayer:FeatureLayer = new FeatureLayer();
featureLayer.featureCollection = new FeatureCollection(featureSet, layerDetails);

//build the query based on a polygon I want to intesect with the features in the featurelayer
var query:Query = new Query();
query.geometry = mypolygon;
query.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
query.outSpatialReference = spatialReference;

//run the query
featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW,new AsyncResponder(onQueryResult2, onQueryFault2));

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:40:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/restrict-feature-layer-using-a-user-drawn-polygon/m-p/625763#M13909</guid>
      <dc:creator>JorgeFiallega</dc:creator>
      <dc:date>2021-12-12T02:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict feature layer using a user drawn polygon</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/restrict-feature-layer-using-a-user-drawn-polygon/m-p/625764#M13910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jorge,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you use Austin's suggestion above to filter your graphics before you create you FeatureCollection?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You would need to use Polygon.contains():&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/geometry/Polygon.html#contains()"&gt;http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/geometry/Polygon.html#contains()&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2012 20:12:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/restrict-feature-layer-using-a-user-drawn-polygon/m-p/625764#M13910</guid>
      <dc:creator>DasaPaddock</dc:creator>
      <dc:date>2012-12-14T20:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict feature layer using a user drawn polygon</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/restrict-feature-layer-using-a-user-drawn-polygon/m-p/625765#M13911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That was simple.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 14:13:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/restrict-feature-layer-using-a-user-drawn-polygon/m-p/625765#M13911</guid>
      <dc:creator>JorgeFiallega</dc:creator>
      <dc:date>2012-12-18T14:13:31Z</dc:date>
    </item>
  </channel>
</rss>

