Select to view content in your preferred language

SpatialRelationship query with ExecuteRelationshipQueryCompleted Event

2181
4
07-21-2010 03:12 AM
MichaelBlom
Deactivated User
Hi there,

Does anyone have working code snippet where they define their Query to have a spatialRelationship property, and then use the ExecuteRelationshipQueryCompleted Event?

Thanks for any snippets or links (I've searched, there's not many - none).

Mike
0 Kudos
4 Replies
MichaelBlom
Deactivated User
The reason i ask is because in my code below IntersectComplete2 never fires, whereas IntersectComplete does.  I am trying to do an "intersect" spatialquery, which is the default, so i don't think i need to define the SpatialRelationship property of my query object.

Problem is, when i get my intersect points returned, i can't tell which polygon they've intersected, I assume qt.ExecuteRelationshipQueryCompleted was designed to solve this issue.

//itterate through polygons of a storm's projected path, and intersect with location points
foreach (var feature in stormPolygons.FeatureSet.Features)
            {
                QueryTask qt = new QueryTask("http://serverAddress/ArcGIS/rest/services/MyData/GlobalPoints/MapServer/0");
                Query q = new Query()
                        {
                            Geometry = feature.Geometry,
                            ReturnGeometry = true,
                            //SpatialRelationship = SpatialRelationship.esriSpatialRelIntersects
                        };
                q.OutFields.Add("*");
                qt.ExecuteRelationshipQueryCompleted += IntersectComplete2;
                //qt.ExecuteCompleted += IntersectComplete;
                qt.ExecuteAsync(q);
              
            }
0 Kudos
dotMorten_esri
Esri Notable Contributor
The relationship query is for querying related tables, so no this shouldn't fire when you call execute.
0 Kudos
MichaelBlom
Deactivated User
Thanks Morten,

Do you have any advice as to how I could find out the polygon/geometry that my returned points are intersecting?

I've looked at the sender and the QueryEventArgs objects, and no properties give me an indication of the polygon used in the intersect.

Thanks,
Michael
0 Kudos
MichaelBlom
Deactivated User
I managed to get around this issue.

When defining my QueryTask i added an attribute which references the polygon involved in the intersect.

This url is passed through to the method executed upon completion of the task.

QueryTask qt = new QueryTask("http://..../ArcGIS/rest/services/Points/GlobalLocations/MapServer/0/query?value=thePolygonName
0 Kudos