Customer Service | Training | Contact Us
You are here: Home > Downloads > ArcScripts > Search Results > Script Details Login | Feedback | Help

Web.ADF .Net query helper classes



contact author | download help | add bookmark | view bookmarks
Author Eric Kauffman
File Name CA.Map.Query.zip
Language C#
Last Modified Nov 3 2009
Status of work Public Domain
Software ArcGIS Server
File Size 6.61 kb
Downloads 7

ArcScripts is intended for the free exchange of scripts and tools related to ESRI software products. Please alert the moderator if this script is a demo, trial-version, or an advertisement for a retail product.


Summary
A while back I created some query-helper classes in C# to make querying layers in a Web.ADF map application much easier to setup and use. I created a base class called "CA.Map.Query.QueryBase.cs" that holds many of the common elements that go into most types of queries. Then I created 3 other classes that inherit the base class. These are "CA.Map.Query.AttributeQuery.cs," "CA.Map.Query.DefinitionQuery.cs," and "CA.Map.Query.Spatial.cs." After writing these classes I recognized oportunities for further simplification, but haven't had time to implement them.

Here is psudeo code that shows how to implement a spatial query. This assumes you have put the classes into your App_Code folder of your application.

------example-------
// Create a new instance of the spatial query class
CA.Map.Query.Spatial spatialQry = new CA.Map.Query.Spatial(Map1_MapControl, "Map_Resource_Name", "Layer_Name", 50 , true);

// Where "50" is the number of records returned and
// the last argument "true" indicates that ADF Geometries of
// each selected feature will be included in the results table

// Perform the selection
ESRI.ArcGIS.Web.Display.Graphics.GraphicsLayer graphicsLayer =
spatialQry.GetGraphicsLayer(myGeometry);

// Where "myGeometry" is of type ESRI.ArcGIS.Web.Geometry.Geometry. You
// can cast points, polygons, lines, etc... into the generic geometry type

That is it!