Interface IMapServer

Namespace
ESRI.ArcGIS.Carto
Assembly
ESRI.Server.Carto.dll

Provides access to members for a MapService.

[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("C1EE7009-1027-4F5A-89AE-0E2CEC6FCEF4")]
public interface IMapServer

Properties

DefaultMapName

Name of the document's active map (data frame).

string DefaultMapName { get; }

Property Value

string

DocumentInfo

A set of name-value pairs for properties set for the map document (mxd only). These properties are string values set in the map document's Map Properties dialog and include: Title, Subject, Author, Category, Keywords and Comments.

IPropertySet DocumentInfo { get; }

Property Value

IPropertySet

Remarks

Optimized MapServer also returns two additional properties – AntialiasingMode and TextAntialiasingMode. Return values for AntialiasingMode are Fastest, Fast, Normal, Best or None, TextAntialiasingMode returns None, Normal or Force.

FilePath

The map document path.

string FilePath { get; }

Property Value

string

MapCount

The number of maps (data frames) in the document.

int MapCount { get; }

Property Value

int

MapName[int]

Name of the map (data frame) as indicated by the index. The first beginning with 0.

string MapName[int Index] { get; }

Parameters

Index int

Property Value

string

PhysicalCacheDirectory

The physical directory for cache files.

string PhysicalCacheDirectory { get; }

Property Value

string

PhysicalOutputDirectory

The physical directory for output files.

string PhysicalOutputDirectory { get; }

Property Value

string

Methods

ComputeDistance(string, IPoint, IPoint, esriUnits)

Computes the distance between two points on the specified map. The result is in the map units of the specified map.

double ComputeDistance(string MapName, IPoint fromPoint, IPoint toPoint, esriUnits Units)

Parameters

MapName string
fromPoint IPoint
toPoint IPoint
Units esriUnits

Returns

double

ComputeScale(IMapDescription, IImageDisplay)

Computes the scale of the specified map, at the given map extent, for an image with the given size.

double ComputeScale(IMapDescription mapDesc, IImageDisplay mapDisplay)

Parameters

mapDesc IMapDescription
mapDisplay IImageDisplay

Returns

double

ExportMapImage(IMapDescription, IImageDescription)

Generates an image of the map, based on the given map description, and writes the image to a specified file on disk. Supported file types are: 'bmp', 'jpg', 'tif', 'png'/'png8', 'png24', 'emf', 'ps', 'pdf', 'ai', 'gif', and 'svg'/'svgz'.

IMapImage ExportMapImage(IMapDescription mapDesc, IImageDescription imageDesc)

Parameters

mapDesc IMapDescription
imageDesc IImageDescription

Returns

IMapImage

Remarks

Use ExportMapImage to retrieve a file (image or vector format) of the map.

The input parameter MapDescription contains properties describing the map (also known as the data frame). These include the map's Name, the MapArea, the SpatialReference, as well as collections of LayerDescription objects. Size, resolution and file format are determined by the ImageDescription, which includes IImageDisplay and IImageType objects.

ExportMapImage returns a IMapImage object. MapExtent, MapScale and an array of VisibleLayers can be retrieved from the MapImage.

You can export the map to either a vector or an image type. This is specified by the ReturnType property of IImageType.

Setting the size and resolution of the output

Size and resolution are set in the ImageDisplay. Both Height and Width are required. The Height and Width properties of IImageResult are read-only and are not used to make changes.

You should be careful when specifying a DeviceResolution to the ImageDisplay. This is merely used by the map service to determine map scale on the server, it does not define the resolution of the map image. Changing the DeviceResolution may lead to unintended changes in the map scale. For example, you export a map image to JPG. You specify an image of 400 pixels by 600 pixels with the DeviceResolution set at 96. The relative MapScale of the resulting image is around 54,000,000. Next, you increase the DeviceResolution to 300 while keeping the size constant. The MapScale of this result is about 205,000,000. The result may not be want you wanted if the map contains layers or labels that are scale-dependent. In order to to maintain the MapScale at around 1:54,000,000 you would need to export a larger image.

If you are exporting to PDF you will need to keep in mind that PDF exits in page space. Setting the Height and Width sets the dimensions of the PDF page. For example, you export a map image to PDF where the ImageDisplay Height is 400 and the Width is 500. The DeviceResolution is 100. The resulting PDF is 4 inches by 5 inches. Holding the Height and Width settings constant, as you increase the DeviceResolution the actual size of the PDF will get smaller. As you decrease the DeviceResolution the size of the PDF gets larger. This will also affect MapScale. If you wish the MapScale to stay constant you will need to increase (or decrease) the ImageDisplay Height and Width values as you increase (or decrease) the DeviceResolution.

DeviceResolution also affects the symbols is rendered. For example, two map images were generated using the same size (250x250), same extent but a different DeviceResolution. The first map image was created with a DeviceResolution of 96 and the second one with 200. You will notice the symbols size differences between those two images. Symbology size is defined using points (1 point = 1/72 inch) in the source map. To determine symbology size in a map, DeviceResolution is used to convert from points to pixels with the following equation:

Symbol Size in Points * (DeviceResolution/Number of Points in 1 inch)
   
In the map image with 96 DeviceResolution, a symbol size of 1 point will use 1.33 pixels (rounded down to 1 pixel) to render. In the map image with 200 DeviceResolution, a symbol size of 1 point will use 2.78 (rounded up to 3 pixels) to render. As a result, the symbology appears larger in the map image created using a DeviceResolution of 200.

  Image quality and image type of optimized MapServer

     
  • Optimized MapServices allow the author of the MapService to set general anti-aliasing options and text anti-aliasing options in the source document (.msd), resulting in a better quality image. A user may use the DocumentInfo property to find out whether the map has anti-aliasing enabled.
  •  
  • Output images may contain artifacts if a client requests a png8 image and the MapService has anti-aliasing enabled, especially when the map's content uses more than 256 colors. The artifacts can occur because anti-aliasing effectively increases the number of colors in the map. If the number of colors in the map increases beyond 256 colors (the limit of a png8 image) then dithering may occur, resulting in a "grainy" appearance in areas of solid color. When anti-aliasing is enabled on the map, use png24 or png32 image formats to obtain higher quality images.
  •  
  • Optimized MapServices add support for the image type PNG32 which allows the use of an alpha band (in addition to RGB bands) to support pixel level transparency. When using the PNG32 format, transparency set on layers in the map gets carried over to the output image. This means that the client application does not need to set any client side transparency when draping the service on top of another map service. Use the ServiceConfigurationInfo property set to find out whether a map service supports PNG32.
  •  
  • Image formats supported by optimized MapServices are "PNG32, PNG24, PNG, JPG, DIB, TIFF , EMF, PS, PDF, GIF, SVG, SVGZ"
  •  
  • Standard MapServices support "PNG24, PNG, JPG, DIB, TIFF, EMF, PS, PDF, GIF, SVG, SVGZ, AI".

  Miscellaneous

Exporting a map from a cached service does not generate map dynamically, instead it creates map using pre-cooked cache tiles.

Exporting a map is different than exporting a layout. Page space is an important component of ExportLayout. It exists for all map documents and the map services the documents are based on. This page space provides the default size of the exported layout (for best results you should use this default). Page space does not exist in ExportMapImage. Therefore, you will see differences in results when adjusting the Height, Width or DeviceResolution for a ExportMapImage as compared to making similar adjustments for ExportLayout.

Use IMapServerGeoTransformation when the image output from a map service is to be displayed in a coordinate system where the underlying geographic coordinate system is different than the underlying geographic coordinate system of the DefaultMapDescription.

[C#]

Example: exporting map for a given time

IMapTimeDescription pMapTimeDesc = pMapDesc as IMapTimeDescription;

ITime pTime = new TimeClass();
// date-time in YYYY/MM/DD hh:mm:ss format
pTime.SetFromTimeString(esriTimeStringFormat.esriTSFYearThruSecondWithSlash, "2000/01/01 09:00:00");

ITimeInstant pTimeInstant = new TimeInstantClass();
pTimeInstant.Time = pTime;
pTimeInstant.TimeReference = pMapTimeDesc.TimeReference;

pMapTimeDesc.TimeValue = pTimeInstant;

IImageDisplay pImgDisp = new ImageDisplayClass();
pImgDisp.DeviceResolution = 96;
pImgDisp.Height = 500;
pImgDisp.Width = 500;


IImageType pImgType = new ImageTypeClass();
pImgType.Format = esriImageFormat.esriImagePNG;
pImgType.ReturnType = esriImageReturnType.esriImageReturnURL;

IImageDescription pImageDesc = new ImageDescriptionClass();
pImageDesc.Display = pImgDisp;
pImageDesc.Type = pImgType;

IMapImage pMapImage = pMapServer.ExportMapImage(pMapDesc, pImageDesc);
Console.WriteLine(pMapImage.URL);

Find(IMapDescription, IImageDisplay, string, bool, string, esriFindOption, ILongArray)

Returns a collection of Map Server Find Result objects that contain the given search string. If LayerIDs is Nothing/Null or empty, all layers are searched.

IMapServerFindResults Find(IMapDescription mapDesc, IImageDisplay MapImage, string searchString, bool Contains, string searchFields, esriFindOption option, ILongArray LayerIDs)

Parameters

mapDesc IMapDescription
MapImage IImageDisplay
searchString string
Contains bool
searchFields string
option esriFindOption
LayerIDs ILongArray

Returns

IMapServerFindResults

Remarks

Find performs a search based on a string value. This search can be conducted on a single field of a single layer, on many fields of a single layer or on many fields on many layers. Find returns a collection of objects that implement IMapServerFindResult.

Find requires a number of input parameters.  These include: a MapDescription, an ImageDisplay, the search string, a Boolean value on whether the search string is an exact match (False) or not (True), a comma delimited list of string values for the names of the fields you want to search, the esriFindOption, and an array of layer Ids to be searched.

Please note that Find only works with layer and does not work with StandaloneTable. It also does not honor any time setting of a layer.

MapDescription

The MapDescription contains all the LayerDescriptions in the map. These LayerDescriptions include a DefinitionExpression property. A DefinitionExpression can be set on a layer in order to limit layer features available for display or query. This expression can be set in the source map document as a definition query, or can be set using the DefinitionExpression property. The DefinitionExpression set in the LayerDescription will override any any definition query set in the source map. MapServer Find results should honor any definition query or DefinitionExpression set on the layer.

ImageDisplay

This is needed to determine whether layers are visible or not based on the current map scale.

Search Fields

If the searchFields parameter is blank all fields will be searched.

esriFindOption

The esriFindOption parameter includes: esriFindAllLayers and esriFindVisibleLayers.  If esriFindAllLayers is being used all layers are valid. If esriFindVisibleLayers is used, the search will be conducted only on layers that are visible in the map display. Layer visibility depends on whether the layer is on or off (the Visible property on ILayerDescription) or whether the layer is on, but not visible due to scale dependencies (the MinScale and MaxScale properties on IMapLayerInfo). The mapImage parameter is needed to determine whether the layer is not visible based on scale dependencies. This parameter can be Nothing/Null if esriFindAllLayers is used.

The parameters esriFindOption and LayerIDs behave like a boolean AND. There is no precedence. For example: if esriFindOption is esriFindVisibleLayers and pLayerIDs is Nothing/Null or empty, all the visible layers are searched. If esriFindOption is esriFindVisibleLayers and pLayerIDs contains only the first layer, the first layer is searched only if it is visible.

Results

Find always honors field visibility, and by default it respects field aliases and field formatting set in the source map document. If you want to use field names instead of field aliases, set ReturnFieldNamesInResults to True. When you want to have value in original data type (i.e. as Double instead of formatted string) so that you can do some computation (e.g. change the numeric or date to your locale settings), set FormatValuesInResults to False. It is important to note that these properties are only honored when the layer being searched implements IFeatureLayer (e.g. FeatureLayer). If the feature being queried has more than one field with the same alias (e.g. when joined), only one will be passed back to the client and the rest will be dropped from the result.

Geometry is always returned in the same spatial reference system as the DefaultMapDescription, even though the source data of a layer may be in a different coordinate system. The value of the Shape field in the result is a string showing the type of the geometry. To get the geometry associated with the result, use the IMapServerFindResult::FeatureShape property.

In some cases, for performance reasons, you may want limit or adjust the geometry being returned in the find result. Use ILayerResultOptions to manage this. If IncludeGeometry is set to False, FeatureShape returns nothing. This should increase performance in cases where feature geometry is large. When ILayerResultOptions is not used, FeatureShape returns geometry. If the Shape field is invisible in the source map, FeatureShape may still contain geometry depending on how IncludeGeometry is set by the user. You can also choose to densify or generalize the geometry returned in FeatureShape using GeometryResultOptions. Densification is used to better support clients that do not support Arcs (e.g. Bezier, Circular etc.). Generalization reduces the amount of geography being sent across the network and should lead to better performance. If LayerResultOptions are not specified for the LayerDescription, query results will include the original geometry.

Miscellaneous

There are two key differences between Find and the other query methods such as QueryData, QueryRowIDs, QueryFeatureData, etc. The first is that Find can work on multiple layers while the query methods work with a single layer. The second is that Find only works with a search string. The query methods use a queryFilter as a parameter. This allows the query to be based on either an attribute filter (SQL expression) or a spatial filter.

FromMapPoints(IMapDescription, IImageDisplay, IPointCollection, ref ILongArray, ref ILongArray)

Converts a map coordinate to a screen location.

void FromMapPoints(IMapDescription MapDescription, IImageDisplay mapDisplay, IPointCollection mapPoints, ref ILongArray screenXValues, ref ILongArray screenYValues)

Parameters

MapDescription IMapDescription
mapDisplay IImageDisplay
mapPoints IPointCollection
screenXValues ILongArray
screenYValues ILongArray

GetLegendInfo(IMapDescription, IImageDisplay, ILongArray, IMapServerLegendPatch, IImageType)

Returns a collection of Map Server Legend Info objects for the specified layers. If layerIDs is Nothing/Null or empty, legend information for all layers is returned.

IMapServerLegendInfos GetLegendInfo(IMapDescription pMapDescription, IImageDisplay pImageDisplay, ILongArray LayerIDs, IMapServerLegendPatch patch, IImageType imgType)

Parameters

pMapDescription IMapDescription
pImageDisplay IImageDisplay
LayerIDs ILongArray
patch IMapServerLegendPatch
imgType IImageType

Returns

IMapServerLegendInfos

Remarks

Use GetLegendInfo to retrieve individual legend elements including the symbol image, labels, descriptions and headings. A common use would be to populate a table of contents. Note that composite layers such as group layers and annotation layers do not contain legend elements. To export a single image of the legend use ExportLegend on IMapServerLayout.

The GetLegendInfo method returns a collection of MapServerLegendInfo objects. Legends are associated with renderers that belong to each layer in a map. Each layer has a separate renderer. Each renderer has one or more legend groups.  Each legend group has one or more legend classes. Customizing the legend patch can be done using IMapServerLegendPatch . When passing in "Nothing" for this input parameter ("patch") the default legend patch is used.

MapServerLegendInfo doesn't contain information about whether the data frame and the layers in the TOC are expanded or collapsed in the original map document. You have to write your own code to find this out.

[C#]

The following sample code shows how to determine whether the data frame and the layers in the TOC are expanded or collapsed in the original map document. The sample assumes that you already have a valid MapServer object.

IMapServer mapServer = m_MapServer;
IMapServerObjects mapServerObjects;
IMapLayerInfos mapLayerInfos;
IMap map;
ILayer layer;
IGroupLayer groupLayer;
ICompositeLayer2 compLayer;
ILegendInfo legendInfo;
string strMapName;
int i, j, k;
Boolean bVisible;
string debugOutput;
// Step through data frames
for (i = 0; i < mapServer.MapCount; i++)
{
    // Get map name
        strMapName = mapServer.get_MapName(i);
        // Get map
        mapServerObjects = (IMapServerObjects)mapServer;
        map = mapServerObjects.get_Map(strMapName);
        // Print whether map (data frame) is expanded or collapsed
        debugOutput = "Map " + i.ToString() + " (" + strMapName + "): " + (map.Expanded ? "Expanded" : "Collapsed");
        MessageBox.Show(debugOutput);
        // Get MapLayerInfos
        mapLayerInfos = mapServer.GetServerInfo(strMapName).MapLayerInfos;
        // Step through layers
        for (j = 0; j < mapLayerInfos.Count; j++)
        {
                // Get layer
                layer = mapServerObjects.get_Layer(strMapName, j);
                // Check if group layer
                if (layer is IGroupLayer)
                {
                        groupLayer = (IGroupLayer)layer;
                        debugOutput = "Layer " + j.ToString() + " (" + layer.Name + "): " + (groupLayer.Expanded ? "Expanded" : "Collapsed");
                        MessageBox.Show(debugOutput);
                }
                // Check if composite layer
                else if (layer is ICompositeLayer2)
                {
                        compLayer = (ICompositeLayer2)layer;
                        debugOutput = "Layer " + j.ToString() + " (" + layer.Name + "): " + (compLayer.Expanded ? "Expanded" : "Collapsed");
                        MessageBox.Show(debugOutput);
                }
                else if (layer is ILegendInfo)
                {
                        legendInfo = (ILegendInfo)layer;
                        // If at least 1 legend group is visible, layer is expanded
                        bVisible = false;
                        for (k = 0; k < legendInfo.LegendGroupCount; k++)
                        {
                                if (legendInfo.get_LegendGroup(k).Visible)
                                {
                                        bVisible = true;
                                        break;
                                }
                        }
                        debugOutput = "Layer " + j.ToString() + " (" + layer.Name + "): " + (bVisible ? "Expanded" : "Collapsed");
                        MessageBox.Show(debugOutput);
                }
                else
                {
                        // All other layers that cannot be expanded or collapsed
                        // -> set them to "expanded"
                        debugOutput = "Layer " + j.ToString() + " (" + layer.Name + "): " + "Expanded";
                        MessageBox.Show(debugOutput);
                }
        }
}

GetSQLSyntaxInfo(string, int)

Returns the SQL syntax information for the specified layer.

ISQLSyntaxInfo GetSQLSyntaxInfo(string MapName, int LayerID)

Parameters

MapName string
LayerID int

Returns

ISQLSyntaxInfo

GetServerInfo(string)

Returns information about a map (data frame).

IMapServerInfo GetServerInfo(string MapName)

Parameters

MapName string

Returns

IMapServerInfo

Remarks

This method returns a MapServerInfo object. Using IMapServerInfo you can retrieve information regarding the present state of the MapServer object. If two (or more) data frames have the same name, Map Server adds a distinctive number at the end of the second name. E.g. Layers and Layers2.

GetSupportedImageReturnTypes()

The supported image return types for the map server. A value of esriImageReturnMimeData means that only MIME data is supported. Otherwise, either MIME data or URLs are supported.

esriImageReturnType GetSupportedImageReturnTypes()

Returns

esriImageReturnType

Identify(IMapDescription, IImageDisplay, IGeometry, int, esriIdentifyOption, ILongArray)

Returns a collection of Map Server Identify Result objects at the given location. If LayerIDs is Nothing/Null or empty, all layers are searched.

IMapServerIdentifyResults Identify(IMapDescription mapDesc, IImageDisplay MapImage, IGeometry searchShape, int Tolerance, esriIdentifyOption option, ILongArray LayerIDs)

Parameters

mapDesc IMapDescription
MapImage IImageDisplay
searchShape IGeometry
Tolerance int
option esriIdentifyOption
LayerIDs ILongArray

Returns

IMapServerIdentifyResults

Remarks

Identify returns map features and their attribute values based on a search location. This can be conducted on an individual layer, the top-most layer, all layers, or just on all the visible layers. This method returns a collection of objects that implement IMapServerIdentifyResult .

Identify requires a number of input parameters. These include: a MapDescription, an ImageDisplay, a search shape, a tolerance, the esriIdentifyOption, and an array of layer Ids to be identified. Please note that it does not work with StandaloneTable.

Time aware layer

Identify recognizes time settings of a layer. When a layer's UseTime is true and MapDescription's TimeValue is set, Identify only searches features that fall within the time frame.

Layer with HTMLPopup

Identify can return results additionally in rich html format. When a layer's  HTMLPopupType is not esriServerHTMLPopupTypeNone, you can use one of identify two htmlpopup options to get identify result in html format the way it is authored.

MapDescription

The MapDescription contains all the LayerDescriptions in the map. These LayerDescriptions include a DefinitionExpression property. A DefinitionExpression can be set on a layer in order to limit layer features available for display or query. This expression can be set in the source map document as a definition query, or can be set using the DefinitionExpression property. The DefinitionExpression set in the LayerDescription will override any any definition query set in the source map. MapServer Identify results should honor any definition query or DefinitionExpression set on the layer.

ImageDisplay

This is needed to determine whether layers are visible or not based on the current map scale.

SearchShape 

Geometry set in ISpatialFilter should meet the following criteria:

  • It should have the Spatial Reference System defined. In cases where it is not defined, the coordinate system is assumed to be in DataFrame’s coordinate system
  • It must be one of the high-level geometries i.e. Point, Multipoint, Polyline, Polygon or Multipatch. Low-level geometry e.g. BezierCurve, CircularCurve must be wrapped into a high-level geometry
  • It must be topologically correct. For more information, see help on IPolygon and ITopologicalOperator::Simplify .

Tolerance

Tolerance is the distance in which features are searched. The unit is in pixel. It is only used for when SearchShape is a point.

esriIdentifyOption

The esriIdentifyOption parameter includes: esriIdentifyAllLayers, esriIdentifyVisibleLayers and esriIdentifyTopmost. If esriIdentifyAllLayers is being used all features for all layers in the map that fall within the tolerance value of the searchShape will be returned. If esriIdentifyVisibleLayers is used then only features from visible layers are returned. Layer visibility depends on whether the layer is on or off (the Visible property on ILayerDescription) or whether the layer is on, but not visible due to scale dependencies (the MinScale and MaxScale properties on IMapLayerInfo). The mapImage parameter is needed to determine whether the layer is not visible based on scale dependencies. The esriIdentifyOption esriIdentifyTopmost refers to the visible layer that is topmost in the map drawing order at the location specified by searchShape.

Layer IDs

The parameters esriIdentifyOption and LayerIDs behave like a boolean AND. There is no precedence. For example: if esriIdentifyOption is esriIdentifyVisibleLayers and pLayerIDs is Nothing/Null or empty, all the visible layers are searched. If esriIdentifyOption is esriIdentifyVisibleLayers and pLayerIDs contains only the first layer, the first layer is searched only if it is visible.

Results

Identify always honors field visibility, and by default it respects field aliases and field formatting set in the source map document. If you want to use field names instead of field aliases, set ReturnFieldNamesInResults to True. When you want to have value in original data type (i.e. as Double instead of formatted string) so that you can do some computation (e.g. change the numeric or date to your locale settings), set FormatValuesInResults to False. It is important to note that these properties are only honored when the layer being identified implements IFeatureLayer (e.g. FeatureLayer).

Geometry is always returned in the same spatial reference system as the DefaultMapDescription , even though the source data of a layer may be in a different coordinate system. The value of the Shape field in the IMapServerIdentifyResult::PropetySet or in related IMapServerRow::PropertySet is a string showing the type of the geometry. To get the geometry associated with the result, use the IMapServerIdentifyResult::Shape property instead. Identify does not return geometry associated with any related feature. If the feature being identified has more than one field with the same name, only one will be passed back to the client and the rest will be dropped from the result.

In some cases, for performance reason, you may want limit or adjust the geometry being returned in the identify result. Use ILayerResultOptions to manage this. If IncludeGeometry is set to False, Shape property returns nothing. This should increase performance in cases where feature geometry is large. When ILayerResultOptions is not used, the Shape property returns geometry. If the Shape field is invisible in the source map, the Shape property may still contain geometry depending on how IncludeGeometry is set by the user. You can also choose to densify or generalize the returned geometry by using GeometryResultOptions. Densification is used to better support clients that do not support Arcs (e.g. Bezier, Circular etc.). Generalization reduces the amount of geography being sent across the network and should lead to better performance.

Miscellaneous

If the layer being identified has a relationship to other tables, the IMapServerRelationship and IMapServerRow interfaces provide access to properties of the relationship and related tables.

[C#]

It assumes that you already have a validServerContext,MapServer,MapDescription andImageDisplay objects and that you are working with a server context. However, if you are not developing an ArcGIS for Server application using a server context, you should use New to create local ArcObjects instead of usingCreateObject onIServerContext.

// Search point

IPoint pSearchPnt = pServerContext.CreateObject("esriGeometry.Point") as IPoint;
pSearchPnt.SpatialReference = pMapDescription.SpatialReference;
pSearchPnt.X = 194000;
pSearchPnt.Y = 4700000;

/*
setting LayerResultOptions to generalize the resultant geometry
*/
//creating GeometryLayerOptions in the server context
IGeometryResultOptions pGeomResultOptions = pServerContext.CreateObject("esriGeodatabase.GeometryResultOptions") as IGeometryResultOptions;
pGeomResultOptions.GeneralizeGeometries = true;
pGeomResultOptions.MaximumAllowableOffset = 2000;

//creating LayerResultOptions the server context
ILayerResultOptions pLayerResultOptions = pServerContext.CreateObject("esriCarto.LayerResultOptions") as ILayerResultOptions;
pLayerResultOptions.IncludeGeometry = true;
pLayerResultOptions.GeometryResultOptions = pGeomResultOptions;

//executing Identify function
IMapServerIdentifyResults pIDResults = pMapServer.Identify(pMapDescription, pImageDisplay, pSearchPnt, 3, esriIdentifyOption.esriIdentifyAllLayers, null);

System.Object O1; System.Object O2; // two dummy objects
System.Array pFieldNameArray; System.Array pValueArray;

for (int i = 0; i &< pIDResults.Count; i++) // looping thru all results
{
IMapServerIdentifyResult pIDResult = pIDResults.get_Element(i);
Debug.Print("Primary value: " + pIDResult.Name + "(LayerID: " + pIDResult.LayerID.ToString() + ")");
Debug.Print(pIDResult.Properties.Count.ToString());

pIDResult.Properties.GetAllProperties(out O1, out O2); // getting all fields & values for a feature
pFieldNameArray = (System.Array)O1;
pValueArray = (System.Array)O2;
for (int i = 0; i &< pIDResults.Count; i++) // looping thru all results
{
  IMapServerIdentifyResult pIDResult = pIDResults.get_Element(i);
  Debug.Print("Primary value: " + pIDResult.Name + "(LayerID: " + pIDResult.LayerID.ToString() + ")");
  Debug.Print(pIDResult.Properties.Count.ToString());

  pIDResult.Properties.GetAllProperties(out O1, out O2); // getting all fields & values for a feature
  pFieldNameArray = (System.Array)O1;
  pValueArray = (System.Array)O2;
  for (int j = 0; j &< pFieldNameArray.Length; j++) //printing field names & values
  {
    Debug.Print(pFieldNameArray.GetValue(j) + ": " + "\t" + pValueArray.GetValue(j).ToString());
  }

  //checking whether it has any related records
  IMapServerRelationships pRelates = pIDResult.RelatedRows;
  if (pRelates != null)
  {
    for (int k = 0; k &< pRelates.Count; k++)
    {
      IMapServerRelationship pRelate = pRelates.get_Element(k);

      //printing the relationship class name
      Debug.Print("\tRelationship: " + pRelate.Name);
      IMapServerRows pRelatedRows = pRelate.Rows;
      if (pRelatedRows != null)
      {
        //looping through each related rows
        for (int l = 0; l &< pRelatedRows.Count; l++)
        {
          IMapServerRow pRelatedRow = pRelatedRows.get_Element(l);
          if (pRelatedRow != null)
          {
            Debug.Print("\t++Related Record for: " + pRelatedRows.get_Element(l).Name);
            pRelatedRow.PropertySet.GetAllProperties(out O1, out O2);
            pFieldNameArray = (System.Array)O1;
            pValueArray = (System.Array)O2;

            //printing fieldnames & values for each related row
            for (int m = 0; m &< pFieldNameArray.Length; m++)
            {
              Debug.Print("\t " + pFieldNameArray.GetValue(m) + ": \t" + pValueArray.GetValue(m).ToString());
            } // end of printing all field-value pairs
          } // end of making sure the row is valid
        } // end of looping all rows
      } // end of checking the relationship has rows
    } // end of looping all relationship
  } // checking whether the result has any related record
  Debug.Print("--------------------------");
} // end of looping all results





















































































QueryData(string, IMapTableDescription, IQueryFilter, IQueryResultOptions)

Returns a record set of rows that meet the query filter selection criteria for the specified table.

IQueryResult QueryData(string MapName, IMapTableDescription pMapTableDescription, IQueryFilter Filter, IQueryResultOptions options)

Parameters

MapName string
pMapTableDescription IMapTableDescription
Filter IQueryFilter
options IQueryResultOptions

Returns

IQueryResult

QueryDataStatistics(string, IMapTableDescription, IStatisticsRequest, IQueryFilter)

Calculates aggregate statistics for one or more fields on a table or layer.

IRecordSet QueryDataStatistics(string MapName, IMapTableDescription pTableDescription, IStatisticsRequest pRequest, IQueryFilter pQueryFilter)

Parameters

MapName string
pTableDescription IMapTableDescription
pRequest IStatisticsRequest
pQueryFilter IQueryFilter

Returns

IRecordSet

QueryRasterValue(string, IMapTableDescription, ILongArray, string, IImageType)

Returns the Raster content that meet the selection criteria for the specified dynamic layer. Use QueryRasterValueEx instead of this for 64 bit OIDs.

IImageResults QueryRasterValue(string MapName, IMapTableDescription pTableDescription, ILongArray rowIDs, string FieldName, IImageType rasterValueType)

Parameters

MapName string
pTableDescription IMapTableDescription
rowIDs ILongArray
FieldName string
rasterValueType IImageType

Returns

IImageResults

QueryRelatedRecords(string, IMapTableDescription, IFIDSet, IRelateDescription)

Returns the IDs of the rows that meet the query filter selection criteria for the specified dynamic layer.

IQueryResult QueryRelatedRecords(string MapName, IMapTableDescription pTableDescription, IFIDSet pFIDs, IRelateDescription RelateDescription)

Parameters

MapName string
pTableDescription IMapTableDescription
pFIDs IFIDSet
RelateDescription IRelateDescription

Returns

IQueryResult

QueryRowCount(string, IMapTableDescription, IQueryFilter)

Returns the count of the rows that meet the query filter selection criteria for the specified table.

int QueryRowCount(string MapName, IMapTableDescription pTableDescription, IQueryFilter pFilter)

Parameters

MapName string
pTableDescription IMapTableDescription
pFilter IQueryFilter

Returns

int

QueryRowIDs(string, IMapTableDescription, IQueryFilter)

Returns the IDs of the rows that meet the query filter selection criteria for the specified table. Use QueryRowIDsEx instead of this for 64 bit OIDs.

ILongArray QueryRowIDs(string MapName, IMapTableDescription pTableDescription, IQueryFilter pFilter)

Parameters

MapName string
pTableDescription IMapTableDescription
pFilter IQueryFilter

Returns

ILongArray

ToMapPoints(IMapDescription, IImageDisplay, ILongArray, ILongArray)

Converts a screen location to a map coordinate.

IPointCollection ToMapPoints(IMapDescription MapDescription, IImageDisplay mapDisplay, ILongArray screenXValues, ILongArray screenYValues)

Parameters

MapDescription IMapDescription
mapDisplay IImageDisplay
screenXValues ILongArray
screenYValues ILongArray

Returns

IPointCollection