Select to view content in your preferred language

how to get the features only within an envelope

801
1
03-31-2011 07:46 AM
MuralidharMoka
Emerging Contributor
Hi,

I have a feature layer say f;

Now say I have the extents with me out of which I created and envelope
How do I get the features only within an envelope
Here is the sample code
FeatureLayer f="http://gis.dev.fmh.com/ArcGISWEB/rest/services/OracleData/ORACLE_BaseLayers_Mapping/0";
f.where="1=0"  //no features
..........................
.........................
Envelope env = new Envelope();
            env.XMin = double.Parse(unitExtents[0].ToString());
            env.YMin = double.Parse(unitExtents[1].ToString());
            env.XMax = double.Parse(unitExtents[2].ToString());
            env.YMax = double.Parse(unitExtents[3].ToString());
//now I want to get the features only within the envelope. I tried like this but know it is not right.
f.where="1=1";
f.Geometry=env;

How do I do this. Can any one help me.


Muralidhar Moka
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
You can use Envelope.Intersects method http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Geometry.E...

You will find however that there will be cases when Intersects() will return true even if the geometries are not touching. For example, the screenshot where green box is my envelope. It is found to intersect with all 3 geometry.Extents (point, line, area) when my real interest is only the point. For this case, you might need to write an extension that checks for all vertices intersecting the envelope.
0 Kudos