Select to view content in your preferred language

Query polygon to information from related table

568
0
02-15-2013 01:08 PM
danielchaboya
Regular Contributor
I've been able to successfully use the Query Related Records Sample using a point feature class from my own service.  However, I would like to perform a query using a polygon feature class.  From the code below, what would need to be adjusted to perform the query on a polygon and not a point.  Any help is greatly appreciated.

void MyMap_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
        {
            graphicsLayer.Graphics.Clear();
            SelectedWellsTreeView.ItemsSource = null;
            RelatedRowsDataGrid.ItemsSource = null;

            Query query = new Query()
            {
                Geometry = Expand(MyMap.Extent, e.MapPoint, 0.01),
                ReturnGeometry = true,
                OutSpatialReference = MyMap.SpatialReference
            };
            query.OutFields.Add("*");

            queryTask.ExecuteAsync(query);
        }
        private Envelope Expand(Envelope mapExtent, MapPoint point, double pct)
        {
            return new Envelope(
                point.X - mapExtent.Width * (pct / 2), point.Y - mapExtent.Height * (pct / 2),
                point.X + mapExtent.Width * (pct / 2), point.Y + mapExtent.Height * (pct / 2))
               
            {
                SpatialReference = mapExtent.SpatialReference
            };
        }
0 Kudos
0 Replies