Select to view content in your preferred language

Using extent.intersect with feature layer

829
5
04-22-2010 05:22 AM
louisversailles
New Contributor
Hi evrybody

I have some problem to loop over a featureLayer to retreve geometry for eatch feature and use it with extent.intersect

someting like the select with extent sample but with a featureLayer

thanks for your help
Tags (2)
0 Kudos
5 Replies
DasaPaddock
Esri Regular Contributor
You can loop over the feature layer's graphicProvider to iterate over each Graphic in the layer, but an easier solution could be to use the feature layer's selectFeatures() method. You can give it a Query object who's geometry is the Extent you want to be selected.

Reference:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/FeatureLayer.html#selectFeatures()
0 Kudos
mei09
by
Deactivated User
You can loop over the feature layer's graphicProvider to iterate over each Graphic in the layer, but an easier solution could be to use the feature layer's selectFeatures() method. You can give it a Query object who's geometry is the Extent you want to be selected.

Reference:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/FeatureLayer.html#selectFeatures()


If we are using ArcGIS Server 9.3.1, and ARCGIS Flex API 1.3,  is this available?
for eg: 1 feature class has all the country's water catchment polygons
           1 feature class has all the different hydrological features (rivers, tributaries etc)

what should be done to have an efficient query to do the following:
for each water catchment polygon, find the hydrological features and display this in a datagrid.

any advice would be much help, since i don't think looping through each water catchment polygon is efficient.

thanks
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
mei76,

   What you are attempting to do is just a simple spatial query.

Look at this example

http://resources.esri.com/help/9.3/arcgisserver/apis/flex/samples/index.html?sample=ShowPointsWithin...

It is querying points based on the current maps extent but the principle is the same for your requirements instead of the using the map extent geometry as the spatial portion of the query you would just pass the water catchment polygon to the query and the query would be using the hydrological features as the layer to query.
0 Kudos
mei09
by
Deactivated User
mei76,

   What you are attempting to do is just a simple spatial query.

Look at this example

http://resources.esri.com/help/9.3/arcgisserver/apis/flex/samples/index.html?sample=ShowPointsWithin...

It is querying points based on the current maps extent but the principle is the same for your requirements instead of the using the map extent geometry as the spatial portion of the query you would just pass the water catchment polygon to the query and the query would be using the hydrological features as the layer to query.


Thanks Robert.
I already understand that there's a sample of that. What I was trying to find out is whether it was possible to just send 1 query to the server, instead of looping for every water catchment polygon, since that would mean n number of queries to the server, which won't be efficient. Also, if this is possible, can the returned results be grouped by each catchment?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
mei 09,

   So what is the design and workflow of your app that you would need to get all of the water catchments and their hydrological features at the same time?...

This can be done using the GeometryService Relation method. You will have to run two queries on to return all the water catchments and then another to return all the hydrological features so that you can feed them into the GeometryService.Relation method. The results of the Relation will have values like "geometry1Index = 999 and geometry2Index = 0" which means that the geometry in the first array with the id of 999 meet the relation requirement that you specified in relation to the geometry in array 2 with the id of geometry2Index of 0.
0 Kudos