Select to view content in your preferred language

Spatial query by multiple features

2170
3
Jump to solution
05-11-2012 04:43 AM
BarisUz
Deactivated User
Dear All,

This question may sound like very easy, however, I found difficulties in implementing it in SDK 2.4.

I have a Query1 on Layer1, returning several features.

I want to run a SPATIAL QUERY (Query2) on another layer (say, Layer2), using the results of the query of Layer1. Let's say I want to select features from Layer2 which are contained by the results of Query1.

I don't want to iterate over the results of Query1. If it returns "n" features, this will result in "n" times execution of Query2.

Is there a way to assign (union, etc.) all the features to query.geometry parameter? In the past using topological operator, etc., we were performing a "Union" on all the features in the feature set. Is there a similar way in Silverlight SDK 2.4? If so, how?

Any help would be highly appreciated. Many thanks in advance.
0 Kudos
1 Solution

Accepted Solutions
JenniferNery
Esri Regular Contributor
If I understood right you want the union of Layer 1 results so you can query Layer 2 that intersect that geometry.
You can look at the following SDK samples:
First, Query Layer 1
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#AttributeQuery
Second, Call Union on Layer 1 query results
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Union
Third, Perform Query on Layer 2 by using Union results as Query.Geometry.
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SpatialQuery

View solution in original post

0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
If I understood right you want the union of Layer 1 results so you can query Layer 2 that intersect that geometry.
You can look at the following SDK samples:
First, Query Layer 1
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#AttributeQuery
Second, Call Union on Layer 1 query results
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Union
Third, Perform Query on Layer 2 by using Union results as Query.Geometry.
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SpatialQuery
0 Kudos
BarisUz
Deactivated User
If I understood right you want the union of Layer 1 results so you can query Layer 2 that intersect that geometry.
You can look at the following SDK samples:
First, Query Layer 1
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#AttributeQuery
Second, Call Union on Layer 1 query results
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Union
Third, Perform Query on Layer 2 by using Union results as Query.Geometry.
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SpatialQuery


Yes, you got it. But the question is: don't we have another option instead of so-called "geometry server" on ArcGIS? We are working on shape files. Can we still use "geometry server" with shape files?

Thanks very much for your reply, indeed.
0 Kudos
dotMorten_esri
Esri Notable Contributor
1. If layer1 is a point layer, you can create a MultiPoint feature with all the selected points in it, and use that for your query.
2. If it's a line layer, just create a new polyline with all the paths from the original polyline. Ie
foreach(var graphic in selectedGraphics)
   foreach(var path in (graphic.Geometry as Polyline).Paths)
       myQueryPolyline.Rings.Add(path)
3. If it's a polygon layer, you can use the same approach as #2, however you might have to simplify the feature first using the GeometryService if these polygons overlap.
0 Kudos