Select to view content in your preferred language

need help deciding what kind of query to use

942
2
04-06-2011 05:50 AM
SangamLama
Emerging Contributor
Hi there,

prior to this new application I'm writing, I've primarily used Identify query to discover various layers on the map. For example, when a user clicks anywhere on the map, the results return what "assets" (hydrants, parcels etc) were discovered on that coordinate. Then I'd access the Attribute property to display details about those assets.

My new application still does those things, but this time I need to be able to make query on an area instead of just a point. So, I'd draw a rectangle, polygon, polyline etc, and that query would return all the assets discovered within that area.  Now for this case, I have given spatial query a shot. It does return the results, but it's a bit difficult to expose the Attribute property onto the datagrid the way I want.

I find Identify query a bit simpler in the sense that I can make one query to include multiple layers at the same time. But if I used Spatial Query, I'd have to make queries to the layers individually (...MapServer/{Layer Number}). I haven't really tried other kinds of queries, but I have fair understanding of what they do. Either way, what do you think is the best practice for what I'm trying to achieve? What query type should I use? Or should I try to combine them?

Thank you
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
If the graphics already exist in your GraphicsLayer, you can use Editor.Select. Editor.EditCompleted event will give you the graphic (check for graphic.Selected property) and layer it belongs to. See this sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsExplicitSave

Otherwise, when draw completes you would have to execute a spatial query on every layer and use UserToken property to help you identify which layer the query is for. http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SpatialQuery
0 Kudos
SangamLama
Emerging Contributor
I decided to use Spatial Query and it works well for the most part. What's not working in every case though are the point and polyline drawmodes. They both work for cases when I'm querying layers such as parcels i.e. layers that cover big areas of the map. But if I query hydrants, and manholes layers (which are only about 3-4 pixels in the map) it doesn't return any features.

My first theory on why it isn't working accurately is that the buffer areas (tolerance) of the point and polyline queries are too small for objects such as hydrants, and therefore would need to be increased. And my second theory is based on this thread
http://forums.arcgis.com/threads/25221-QueryTask-on-point-and-line-feature-not-resulting-into-featur..., which means I'd probably need to specify the spatialrelationship to achieve the features.

I'm not sure how I'd do specify either of those fields on a spatial query though? Thanks


If the graphics already exist in your GraphicsLayer, you can use Editor.Select. Editor.EditCompleted event will give you the graphic (check for graphic.Selected property) and layer it belongs to. See this sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsExplicitSave

Otherwise, when draw completes you would have to execute a spatial query on every layer and use UserToken property to help you identify which layer the query is for. http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SpatialQuery
0 Kudos