|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IMapServer3
Provides access to members that serve maps.
This interface is new at ArcGIS 10.0. It supersedes IMapServer2.
Method Summary | |
---|---|
double |
computeDistance(String mapName,
IPoint fromPoint,
IPoint toPoint,
int units)
Computes the distance between two points on the specified map. |
double |
computeScale(IMapDescription mapDesc,
IImageDisplay mapDisplay)
Computes the scale of the specified map, at the given map extent, for an image with the given size. |
IMapImage |
exportMapImage(IMapDescription mapDesc,
IImageDescription imageDesc)
Generates an image of the map, based on the given map description, and writes the image to a specified file on disk. |
IImageResult |
exportScaleBar(IScaleBar scalebar,
IMapDescription mapDesc,
IImageDisplay pMapDisplay,
IColor backgroundColor,
IImageDescription imageDesc)
Exports a scale bar to an image file. |
IMapServerFindResults |
find(IMapDescription mapDesc,
IImageDisplay mapImage,
String searchString,
boolean contains,
String searchFields,
int option,
ILongArray layerIds)
Returns a collection of Map Server Find Result objects that contain the given search string. |
void |
fromMapPoints(IMapDescription mapDescription,
IImageDisplay mapDisplay,
IPointCollection mapPoints,
ILongArray[] screenXValues,
ILongArray[] screenYValues)
Converts a map coordinate to a screen location. |
ILayerDrawingDescriptions |
getDefaultLayerDrawingDescriptions(String mapName,
ILongArray pLayerIDs,
IServerSymbolOutputOptions outputOptions)
Get Layer Drawing Description |
String |
getDefaultMapName()
Name of the document's active map (data frame). |
IPropertySet |
getDocumentInfo()
A set of name-value pairs for properties set for the map document (mxd only). |
IMapServerLegendInfos |
getLegendInfo(String mapName,
ILongArray layerIds,
IMapServerLegendPatch patch,
IImageType imgType)
Returns a collection of Map Server Legend Info objects for the specified layers. |
int |
getMapCount()
The number of maps (data frames) in the document. |
String |
getMapName(int index)
Name of the map (data frame) as indicated by the index. |
IMapTableSubtypeInfos |
getMapTableSubtypeInfos(String mapName,
ILongArray pTableIDs)
Returns the MapTableSubtypeInfos in the current map. |
IMapServerInfo |
getServerInfo(String mapName)
Returns information about a map (data frame). |
IPropertySet |
getServiceConfigurationInfo()
A set of name-value pairs for properties set for the MapServer Service Configuration Restrictions. |
ISQLSyntaxInfo |
getSQLSyntaxInfo(String mapName,
int layerID)
Returns the SQL syntax information for the specified layer. |
int |
getSupportedImageReturnTypes()
The supported image return types for the map server. |
IMapServerIdentifyResults |
identify(IMapDescription mapDesc,
IImageDisplay mapImage,
IGeometry searchShape,
int tolerance,
int option,
ILongArray layerIds)
Returns a collection of Map Server Identify Result objects at the given location. |
IAttachmentDataArray |
queryAttachmentData(String mapName,
int tableID,
ILongArray attachmentIDs,
int transportType)
Returns the attachment data for the given features/ rows. |
IAttachmentInfoArray |
queryAttachmentInfos(String mapName,
int tableID,
ILongArray rowIDs)
Returns the attachment info that describe the attachments for the given features/ rows. |
IQueryResult |
queryData(String mapName,
IMapTableDescription pMapTableDescription,
IQueryFilter filter,
IQueryResultOptions options)
Returns a record set of rows that meet the query filter selection criteria for the specified table. |
int |
queryFeatureCount(String mapName,
int layerID,
IQueryFilter filter)
Returns the count of the features that meet the query filter selection criteria for the specified layer. |
int |
queryFeatureCount2(String mapName,
ILayerDescription pLayerDescription,
IQueryFilter filter)
Returns the count of the features that meet the query filter selection criteria for the specified layer. |
IRecordSet |
queryFeatureData(String mapName,
int layerID,
IQueryFilter filter)
Returns a record set of features that meet the query filter selection criteria for the specified layer. |
IQueryResult |
queryFeatureData2(String mapName,
ILayerDescription pLayerDesciscription,
IQueryFilter filter,
IQueryResultOptions options)
Returns a record set of features that meet the query filter selection criteria for the specified layer. |
IFIDSet |
queryFeatureIDs(String mapName,
int layerID,
IQueryFilter filter)
Returns the IDs of the features that meet the query filter selection criteria for the specified layer. |
IFIDSet |
queryFeatureIDs2(String mapName,
ILayerDescription pLayerDesciscription,
IQueryFilter filter)
Returns the IDs of the features that meet the query filter selection criteria for the specified layer. |
IStringArray |
queryHTMLPopups(String mapName,
int tableID,
ILongArray pRowIDs)
Returns the html as text that can be used in popups. |
IMapServerHyperlinks |
queryHyperlinks(IMapDescription mapDesc,
IImageDisplay mapImage,
ILongArray layerIds)
Returns a collection of Map Server Hyperlink objects for the specified layers. |
IImageResults |
queryRasterValue(String mapName,
int sourceTableID,
ILongArray rowIDs,
String fieldName,
IImageType rasterValueType)
Returns the Raster content that meet the selection criteria for the specified table. |
IQueryResult |
queryRelatedRecords(String mapName,
int sourceTable,
IFIDSet pFIDs,
IRelateDescription relateDescription)
Returns the IDs of the rows that meet the query filter selection criteria for the specified table. |
int |
queryRowCount(String mapName,
IMapTableDescription pTableDescription,
IQueryFilter pFilter)
Returns the count of the rows that meet the query filter selection criteria for the specified table. |
ILongArray |
queryRowIDs(String mapName,
IMapTableDescription pTableDescription,
IQueryFilter pFilter)
Returns the IDs of the rows that meet the query filter selection criteria for the specified table. |
IPointCollection |
toMapPoints(IMapDescription mapDescription,
IImageDisplay mapDisplay,
ILongArray screenXValues,
ILongArray screenYValues)
Converts a screen location to a map coordinate. |
Method Detail |
---|
IQueryResult queryData(String mapName, IMapTableDescription pMapTableDescription, IQueryFilter filter, IQueryResultOptions options) throws IOException, AutomationException
QueryData returns the records of map features from a layer or of rows from a table that match the parameters of a given query filter. QueryData returns a QueryResult. A QueryResult format can be a RecordSet, a KMZ, JSON or AMF. The Format of the QueryResult is specified in QueryResultOptions. QueryResultOptions can also be used to specify a GeoTransformation if one is needed.
QueryData requires a number of input parameters. These include: a MapName, IMapTableDescription and a IQueryFilter. The QueryFilter can be an attribute query (SQL expression), a spatial query, a time query, a combination of all or null. ILayerDescription2 has SourceID property that can be used to query against a GP result.
LayerDescription for a layer can be obtained from MapServerInfo::DefaultMapDescription while StandaloneTableDescription can be obtained using MapServerInfo::StandaloneTableDescriptions property.
QueryFilter
QueryFilter provides the ability to query based on attribute filter (SQL expression), a spatial filter, time filter, a combination of both or null. Attribute filters take any valid ‘non-GIS data specific’ SQL statement. For example, CNTRY_CODE = ‘BD’ or POPULATION = 12345. Syntax for querying date fields depend on the underlying data. If you are working with Shapefile or File GeoDatabase data the syntax is <FieldName> = date ‘YYYY-MM-DD’; for Access-based Personal GeoDatabase the syntax is #YYYY-MM-DD#. For SDE database, check with the specific database’s help.
It can be set to null or Nothing to retrieve all data (which is also limited by MaxRecordCount)
If geometry is not desired in the output RecordSet, IQuerFilter’s SubFields must be defined without ‘Shape’ field. When SubFields is empty or includes ‘Shape’, IRecordSet will include the fields "shape_length" and "shape_area". If the desired spatial reference of the output geometry is different than the original one, OutputSpatialReference should be used. Otherwise geometry is returned in the same spatial reference system as the DefaultMapDescription by default.
When SubFields is not defined or = “*”, it returns all visible fields. Invisible or invalid field names or field aliases must not be included in SubField’s string or it will return an error. You may get the list of all visible fields from IMapTableInfo::Fields. Please note ObjectID field is always returned regardless of whether it is in the SubFields or not. Only expection is when DISTINCT is used.
When only the unique value from a field is desired, you need to set PrefixClause = "DISTINCT". In case when you want the result sorted by field(s), set ORDER BY <field1, field2,...> to PostfixClause. Please note these options will only be honored when the source database supports that such as ArcSDE GeoDatabase, File GeoDatabase and Personal GeoDatabase.
Note: MapServer query function does not support raster data. You should avoid including raster field from SubFields.
TimeQueryFilter
When a layer is time aware (use IMapTableTimeInfo::SupportsTime property), a query can be made to retrieve a set of features that are available at a specific time or for a period of time. In order to perform a time query, TimeQueryFilter object needs to created and passed in to this function. Since the object implements IQueryFilter and ISpatialFilter interfaces, an attribute or spatial query can be combined with time.
Values in StartTimeField or EndTimeField are returned in the Layer's TimeReference. If the desired time reference is different than the layer's one, OutputTimeReference should be explicitly set.
SearchShape
It is only required for spatial query. Since a table does not contain geometry, SearchShape is ignored when a table is queried. Geometry set in SpatialFilter should meet the following criteria:
DefinitionExpressions
A DefinitionExpression can be set on a layer or a standalone table in order to limit layer features or rows available for display or query. This expression can be also be set in the source map document as a definition query. Any DefinitionExpression set in the LayerDescription or StandaloneTableDescription will override any definition query set in the source map. MapServer QueryData honors DefinitionExpression.
Let's look at some examples. You have a layer in your map that represents sales regions. The layer includes fields REGIONS, SALES and MANAGER.
Example #1: In the source map the layer has a definition query, "REGION = 'North'". No DefinitionExpression is specified in LayerDescription. Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be all sale region features that fall within the North region and are managed by Bob.
Example #2: In the source map the layer has a definition query, "REGION = 'North'". You apply a DefinitionExpression in LayerDescription as "SALES > 1000". Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be all sale region features with sales over 1000 and are managed by Bob. QueryData honors the DefinitionExpression set in LayerDescription. The DefinitionExpression overrides the definition query set in the source map. If you wish to include the layer's original definition query, "REGION = 'North'" in your final query, you must include this in your QueryFilter, ""MANAGER = 'Bob' AND "REGION = 'North'".
Example #3: In the source map the layer has no definition query. You apply a DefinitionExpression in LayerDescription as "SALES > 1000". Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be all sale region features with sales over 1000 and are managed by Bob. QueryData honors the DefinitionExpression set in LayerDescription.
Results
For KML (Keyhole Markup Language), JSON (JavaScript Object Notation) or AMF (Action Message Format), result can be passed back as a URL (when QueryResultOptions.Format is esriQueryResultKMLAsURL) or as a MIME object (when QueryResultOptions.Format is esriQueryResultKMLAsMime).
KML is returned in compressed KMZ format. Setting LayerResultOptions has no effect on KML output.
RecordSet
When esriQueryResultRecordSetAsObject is selected as QueryResultFormat, the function returns RecordSet as an Object. Use IQueryResult::Object property to access that. The returned object needs to be QI to IRecordSet.
Result Geometry
By default, geometry is returned in the same spatial reference as the DefaultMapDescription. The spatial reference of QueryFeatureData2 results can be set to something different than the DefaultMapDescription by using OutputSpatialReference. OutputSpatialReference is a property of IQueryFilter. For SOAP/WSDL users, both OutputSpatialReference & SpatialReferenceFieldName properties are required and must be set.
In some instances the result may require a GeoTransformation . For example, a given map service may be using a spatial reference system based on GCS_WGS_1984. A client wants to display QueryFeatureData2 results based on this map service in a different spatial reference, GCS_European_1950. The results will use the spatial reference of the DefaultMapDescription, GCS_WGS_1984, and display these results incorrectly in GCS_European_1950. Features may not "line up" correctly. In order to correctly display these results a GeoTransformation is needed. Applying the correct GeoTransformation ensures the spatial correctness of the result.
Another instance where a GeoTransformation may be need to be specified in the QueryResultsOption is if the queried layer is projected on the fly within the map service. That is, the coordinate system of the layer's source is different than the DefaultMapDescription coordinate system, and no appropriate transformation has been set in the map document before serving. In this case, you can access the coordinate system of a layer source by first getting the layer's MapLayerInfo, then get Fields from MapLayerInfo, get the Shape Field from Fields, get GeometryDef from Field, and finally, get the SpatialReference from GeometryDef.
A GeoTransformation is not needed if the projected coordinate systems share the same underlying geographic coordinate system. For best results it is optimal for data (layers within the map service), map service and MapServer output to use the same coordinate system.
In some cases, may be for performance reasons, you may want limit or adjust the geometry being returned in the record set result. Use ILayerResultOptions to manage this. If IncludeGeometry is set to False, geometry is not included in the recordset. This should increase performance in cases where feature geometry is large. 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.
Field visibility and field aliases
QueryData honors field visibility and field aliases set in the source map document. However, the RecordSet does NOT honor any field formatting set in the source map.
Miscellaneous
In order to control the amount of information MapServer needs to process for a query, a maximum number of records can be set. This value is contained in the MaxRecordCount property on IMapServerInit2. The default value for this property is 500. If 600 features match a given query only the first 500 results will be returned. You will be unable to access the remaining 100 records. To be able to access these records the MaxRecordCount would need to be increased to 600. MaxRecordCount can also be changed by modifying the MaxRecordCount XML tag in the MapServer's configuration file.
There are two key differences between Find and QueryFeatureData2. 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.
The main differences between QueryData & QueryFeatureData are that the former can search both layer and table and honors their settings e.g. DefinitionExpression etc.
Precedence
In case where both IQueryFilter::SubField and ILayerResultOption::IncludeGeometry is set, SubField takes precedence over IncludeGeometry. For example, when SubField = “Shape, FName, LName, Address” and IncludeGeometry = False, the output recordset will contain geometry as contained within the Shape field.
mapName
- The mapName (in)pMapTableDescription
- A reference to a com.esri.arcgis.carto.IMapTableDescription (in)filter
- A reference to a com.esri.arcgis.geodatabase.IQueryFilter (in)options
- A reference to a com.esri.arcgis.carto.IQueryResultOptions (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.int queryRowCount(String mapName, IMapTableDescription pTableDescription, IQueryFilter pFilter) throws IOException, AutomationException
QueryRowCount returns the number of map features from a layer or of row from a table that match the parameters of a given query filter.
QueryRowCount requires a number of input parameters. These include: a MapName, IMapTableDescription and a IQueryFilter.
LayerDescription for a layer can be obtained from MapServerInfo::DefaultMapDescription while StandaloneTableDescription can be obtained using MapServerInfo::StandaloneTableDescriptions property.
QueryFilter
QueryFilter provides the ability to query based on attribute filter (SQL expression), a spatial filter, time filter, a combination of both or null. Attribute filters take any valid ‘non-GIS data specific’ SQL statement. For example, CNTRY_CODE = ‘BD’ or POPULATION = 12345. Syntax for querying date fields depend on the underlying data. If you are working with Shapefile or File GeoDatabase data the syntax is <FieldName> = date ‘YYYY-MM-DD’; for Access-based Personal GeoDatabase the sytax is #YYYY-MM-DD#. For SDE database, check with the specific database’s help.
TimeQueryFilter
When a layer is time aware (use IMapTableTimeInfo::SupportsTime property), a query can be made to retrieve a set of features that are available at a specific time or for a period of time. In order to perform a time query, TimeQueryFilter object needs to created and passed in to this function. Since the object implements IQueryFilter and ISpatialFilter interfaces, an attribute or spatial query can be combined with time.
SearchShape
Geometry set in ISpatialFilter should meet the following criteria:
DefinitionExpressions
A DefinitionExpression can be set on a layer in order to limit layer features available for display or query. This expression can be also be set in the source map document as a definition query. Any DefinitionExpression set in the LayerDescription will override any definition query set in the source map. MapServer QueryFeatureCount2 honors DefinitionExpression.
Let's look at some examples. You have a layer in your map that represents sales regions. The layer includes fields REGIONS, SALES and MANAGER.
Example #1: In the source map the layer has a definition query, "REGION = 'North'". No DefintionExpression is specified in LayerDescription. Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be a count of all sale region features that fall within the North region and are managed by Bob.
Example #2: In the source map the layer has a definition query, "REGION = 'North'". You apply a DefinitionExpression in LayerDescription as "SALES > 1000". Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be a count of all sale region features with sales over 1000 and are managed by Bob. QueryFeatureCount2 honors the DefinitionExpression set in LayerDescription. The DefinitionExpression overrides the definition query set in the source map. If you wish to include the layer's original defintion query, "REGION = 'North'" in your final query, you must include this in your QueryFilter, ""MANAGER = 'Bob' AND "REGION = 'North'".
Example #3: In the source map the layer has no definition query. You apply a DefinitionExpression in LayerDescription as "SALES > 1000". Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be a count of all sale region features with sales over 1000 and are managed by Bob. QueryFeatureCount2 honors the DefinitionExpression set in LayerDescription.
Miscellaneous
MaxRecordCount does not affect QueryRowCount.
mapName
- The mapName (in)pTableDescription
- A reference to a com.esri.arcgis.carto.IMapTableDescription (in)pFilter
- A reference to a com.esri.arcgis.geodatabase.IQueryFilter (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ILongArray queryRowIDs(String mapName, IMapTableDescription pTableDescription, IQueryFilter pFilter) throws IOException, AutomationException
QueryRowIDs returns an array of ObjectIDs unlike QueryFeatuerIDs or QueryFeatureIDs2. Each integer represents a unique identifier for each feature (FID) of a layer or row of a table being queried.
Please note quering a table with no ObjectID field (such as Excel, text files etc.) fails. You may want to check OIDFieldName to find out whether the table has ObjectID field.
The key differences between QueryRowIDs and QueryFeatureIDs2 are:
QueryRowIDs requires a number of input parameters. These include: a MapName, IMapTableDescription and a IQueryFilter.
LayerDescription for a layer can be obtained from MapServerInfo::DefaultMapDescription while StandaloneTableDescription can be obtained using MapServerInfo::StandaloneTableDescriptions property.
QueryFilter
QueryFilter provides the ability to query based on attribute filter (SQL expression), a spatial filter, time filter, a combination of both or null. Attribute filters take any valid ‘non-GIS data specific’ SQL statement. For example, CNTRY_CODE = ‘BD’ or POPULATION = 12345. Syntax for querying date fields depend on the underlying data. If you are working with Shapefile or File GeoDatabase data the syntax is <FieldName> = date ‘YYYY-MM-DD’; for Access-based Personal GeoDatabase the sytax is #YYYY-MM-DD#. For SDE database, check with the specific database’s help.
TimeQueryFilter
When a layer is time aware (use IMapTableTimeInfo::SupportsTime property), a query can be made to retrieve a set of features that are available at a specific time or for a period of time. In order to perform a time query, TimeQueryFilter object needs to created and passed in to this function. Since the object implements IQueryFilter and ISpatialFilter interfaces, an attribute or spatial query can be combined with time.
SearchShape
Geometry set in ISpatialFilter should meet the following criteria:
DefinitionExpressions
A DefinitionExpression can be set on a layer in order to limit layer features available for display or query. This expression can be also be set in the source map document as a definition query. Any DefinitionExpression set in the LayerDescription will override any definition query set in the source map. MapServer QueryFeatureIDs2 honors DefinitionExpression.
Let's look at some examples. You have a layer in your map that represents sales regions. The layer includes fields REGIONS, SALES and MANAGER.
Example #1: In the source map the layer has a definition query, "REGION = 'North'". No DefintionExpression is specified in LayerDescription. Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be the ids of all sale region features that fall within the North region and are managed by Bob.
Example #2: In the source map the layer has a definition query, "REGION = 'North'". You apply a DefinitionExpression in LayerDescription as "SALES > 1000". Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be the ids of all sale region features with sales over 1000 and are managed by Bob. QueryFeatureIDs2 honors the DefinitionExpression set in LayerDescription. The DefinitionExpression overrides the definition query set in the source map. If you wish to include the layer's original defintion query, "REGION = 'North'" in your final query, you must include this in your QueryFilter, ""MANAGER = 'Bob' AND "REGION = 'North'".
Example #3: In the source map the layer has no definition query. You apply a DefinitionExpression in LayerDescription as "SALES > 1000". Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be the ids of all sale region features with sales over 1000 and are managed by Bob. QueryFeatureIDs2 honors the DefinitionExpression set in LayerDescription.
Page through Result
Result from QueryRowIDs can be used to page through a result. When a query is expected to return a lot of rows and showing all those records on a single page is not desirable, you may use the following steps to page through your result and get records for a selected subset on demand:
Miscellaneous
MaxRecordCount does not affect QueryRowIDs.
The results of this function can be used with LayerDescription::SelectionFeatures to display the selection in the exported image.
mapName
- The mapName (in)pTableDescription
- A reference to a com.esri.arcgis.carto.IMapTableDescription (in)pFilter
- A reference to a com.esri.arcgis.geodatabase.IQueryFilter (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IQueryResult queryRelatedRecords(String mapName, int sourceTable, IFIDSet pFIDs, IRelateDescription relateDescription) throws IOException, AutomationException
When esriRelateResultRelatedRecordSetAsObject is selected as ResultFormat, the function returns RelatedRecordSet embedded within a QueryResult. Use QueryResult.Object to get RelatedRecordSet.
An FIDSet needs to be created and assign an array of ObjectID to FIDArray property. Related records for ObjectID(s) contained by FIDSet will be queried. Typically this function follows QueryData, in that case you can use values of OIDField from the returned RecordSet to populate FIDSet.
RelateDescription contains information about relationship that will be explored. RelateDescription needs to be created and populated with relates ID, list of fields and output result format. In case where both RelatedTableFields and IncludeGeometry is set, RelatedTableFields takes precedence over IncludeGeometry. For example, when RelatedTableFields = “Shape, FName, LName, Address” and IncludeGeometry = False, the output recordset will contain geometry as contained within the Shape field.
When more than one ObjectID is passed, use SourceRowID to relate ‘related rows’ back to the source feature or row.
The result honors the fields visibility set in the layer or the standalone table.
Output Spatial and Time Reference
If the desired spatial reference of the output geometry is different than the original one, OutputSpatialReference should be used. Otherwise geometry is returned in the same spatial reference system as the DefaultMapDescription by default.
Values in StartTimeField or EndTimeField are returned in the Layer's TimeReference. If the desired time reference is different than the layer's one, OutputTimeReference should be explicitly set.
Relates with non GeoDatabase Tables
Since QueryRelatedRecords relies on IDs of features or rows from the source layer/table, when a table does not have an OIDField (not a Geodatabase table), finding related records from the source layer/table from the destination table is not possible. For example, when a Parcel layer is related to a Owership table (for example from an Oracle database), you may find related ownership information for a parcel, but the function does not allow to find parcels belong to a owner. In order to traverse the other way a table must have a OIDField. You may consider one of the following options for this type of scenario:
Please note that retrieving related rows that has joins may impact the performance.
mapName
- The mapName (in)sourceTable
- The sourceTable (in)pFIDs
- A reference to a com.esri.arcgis.geodatabase.IFIDSet (in)relateDescription
- A reference to a com.esri.arcgis.carto.IRelateDescription (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IImageResults queryRasterValue(String mapName, int sourceTableID, ILongArray rowIDs, String fieldName, IImageType rasterValueType) throws IOException, AutomationException
An array of IImageResult3. IImageResult3 contains the returned mime type and either the url to the image or the mime data itself.
The ImageResult in the resultant array are returned in the same order the OIDs are passed in. If the feature does not have any raster data, a null is returned.
RasterFieldName is optional since a layer can have only one raster field. In case of join, you may need to pass in the field name, if an empty string is passed the raster field from the base table will be used.
OutImageType is optional as well. When a null is passed in as outImageType, jpeg and url are used as the default image format and returned type respectively.
mapName
- The mapName (in)sourceTableID
- The sourceTableID (in)rowIDs
- A reference to a com.esri.arcgis.system.ILongArray (in)fieldName
- The fieldName (in)rasterValueType
- A reference to a com.esri.arcgis.carto.IImageType (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IAttachmentInfoArray queryAttachmentInfos(String mapName, int tableID, ILongArray rowIDs) throws IOException, AutomationException
An array of objects that supports IAttachmentInfo. Each AttachmentInfo object represents metadata for each multimedia data such as Attachment ID, content mime type, name, source OID and size in bytes.
You should check MapLayerInfo.HasAttachments before using this function.
mapName
- The mapName (in)tableID
- The tableID (in)rowIDs
- A reference to a com.esri.arcgis.system.ILongArray (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IAttachmentDataArray queryAttachmentData(String mapName, int tableID, ILongArray attachmentIDs, int transportType) throws IOException, AutomationException
An array of objects that support IAttachmentData. Each AttachmentData object contains AttachmentInfo to relate the data back to the feature/row that this data is attached to, the attachment data and the url to the data.
Use QueryAttachmentInfos to get AttachmentIDs for all attached multimedia data attached to a feature/row.
mapName
- The mapName (in)tableID
- The tableID (in)attachmentIDs
- A reference to a com.esri.arcgis.system.ILongArray (in)transportType
- A com.esri.arcgis.system.esriTransportType constant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IStringArray queryHTMLPopups(String mapName, int tableID, ILongArray pRowIDs) throws IOException, AutomationException
An array of string. Each string represents rich html formatted attributes of a feature.
You should check MapLayerInfo.HTMLPopupType before using this function.
The html content in results are returned in the same order the OIDs are passed in. If you want to query feature based on location and get result back as rich html, you may use Identify function with esriIdentifyVisibleWithHTMLPopup or esriIdentifyTopOneWithHTMLPopup.
This function does not allow a client to format the attribute, instead it returns html content the way an author formatted the result in the source map.
mapName
- The mapName (in)tableID
- The tableID (in)pRowIDs
- A reference to a com.esri.arcgis.system.ILongArray (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ILayerDrawingDescriptions getDefaultLayerDrawingDescriptions(String mapName, ILongArray pLayerIDs, IServerSymbolOutputOptions outputOptions) throws IOException, AutomationException
An array of ILayerDrawingDescription for layers which IDs were passed in. The result contains drawing descriptions only for feature layers. Therefore the count of input LayerIDs may not match with the count of returned array. If any ID is passed in that is neither of a FeatureLayer nor of an existing layer, no drawing description will be returned for that ID.
You may want to use IMapLayerInfo::HasLayerDrawingDescription to check whether MapServer will return ILayerDrawingDescription for a layer.
outputOptions parameter can be Null, in that case MapServer returns images in PNG format. In absence of virtual directory images are returned as PNG mime.
A LayerDrawingDescription object contains information on the symbology and label specified by the author. FeatureRenderer describes how the layer is symbolized while LabelingDescription contains all label classes defined in the source map by the author.
Please note that MapServer only returns the followings:
Types of renderer:
Types of symbol:
point features
line features
polygon features
If a layer’s renderer is not one of those supported one, nothing will be returned. Symbols that are not the supported get downgraded to one of supported one. Please see the rules below.
Here is how a layer’s symbols get downgraded:
Point symbols
Line symbols
Polygon symbols
Labels:
Script Type | Supported Keywords | Converted Keywords |
---|---|---|
VBScript Concatenation | & | CONCAT |
VBScript Newline | vbNewline, vbLf, VbCrLf, vbCr | NEWLINE |
VBScript Literals | " " | " " |
VBScript Functions |
FormatDateTime( [FieldName] , NamedFormat )
* please note the numeric values for these |
FormatDate([Date_Time] , FormatString)
|
UCase([FieldName]) | UCASE([FieldName]) | |
LCase([FieldName]) | LCASE([FieldName]) | |
Round([FieldName], n) | ROUND([FieldName], n) | |
JScript expressions | are not supported for 10.0 |
LabelPlacement
In ArcMap label positions are constrained by 2 different options. They are listed below. The list also shows what are they converted to by MapServer.
When more than one options are checked in ArcMap, MapServer gives priority in the order they are listed above unless “Start Point Priorities” are blocked for that position.
Here are few examples:
Example#1: check the screen shot below where in ArcMap (a)
"Above" is checked, (b) "Location along the line" is "At Start" and
(c) "Before" in "Start Point Priorities" has higher priority,
MapServer returns
esriServerLinePlacementAboveBefore.
Example#2: check the screen shot below where in ArcMap (a) both "On the line" and "Below" positions are checked, (b) "Location along the line" is "At Start" and (c) "At" and "After" in "Start Point Priorities" have same higher priority than "Before", MapServer returns esriServerLinePlacementCenterStart .
mapName
- The mapName (in)pLayerIDs
- A reference to a com.esri.arcgis.system.ILongArray (in)outputOptions
- A reference to a com.esri.arcgis.carto.IServerSymbolOutputOptions (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IMapTableSubtypeInfos getMapTableSubtypeInfos(String mapName, ILongArray pTableIDs) throws IOException, AutomationException
Use GetMapTableSubtypeInfos to get the subtype and domain information for all or given layers and standalonetables from a Map. The function returns IMapTableSubtypeInfos which contains a collection of IMapTableSubtypeInfo for each layer/standalonetable whose HasSubtype value is True.
The function takes an array of standalonetable and layer ids. When this parameter is Nothing/Null, all layers and standalonetables are checked for subtypes. No IMapTableSubtypeInfo returned for layers/tables that does not have subtypes. Therefore the count of input TableIDs may not match with the count of returned array of IMapTableSubtypeInfo. Use TableID to find which layer/table one IMapTableSubtypeInfo belongs to.
IMapTableSubtypeInfo contains information about all subtypes and domains assigned at subtype level. When a field is invisible even though it may have domain assigned for a subtype, FieldDomainInfo for that field is not returned.
Also, note that subtype and domains are not returned from joined table.
The function returns empty result when the CodeCount of all CodedValueDomains from all layers and tables exceeds MaxDomainCodeCount. It does not affect DCOM clients.
mapName
- The mapName (in)pTableIDs
- A reference to a com.esri.arcgis.system.ILongArray (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IPropertySet getDocumentInfo() throws IOException, AutomationException
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.
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.int getMapCount() throws IOException, AutomationException
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.String getMapName(int index) throws IOException, AutomationException
index
- The index (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.String getDefaultMapName() throws IOException, AutomationException
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.
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IMapServerInfo getServerInfo(String mapName) throws IOException, AutomationException
This method returns a MapServerInfo object. Using IMapServerInfo3 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.
When total number of domain codes from all layers and tables exceeds MaxDomainCodeCount, domains are dropped from field level. It does not affect DCOM clients.
mapName
- The mapName (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IMapImage exportMapImage(IMapDescription mapDesc, IImageDescription imageDesc) throws IOException, AutomationException
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 ImageDisplay and ImageType objects.
ExportMapImage returns a MapImage 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. In order to control the size of an exported image, IMapServerInit2 contains two properties: MaxImageHeight and MaxImageWidth. The default value for these properties is 1024 pixels.
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 MapServer
dynamicLayers
The following functionalities are only supported when a mapservice is published with dynamicLayer enabled. SupportsDynamicLayers returns True when a mapservice is dynamicLayer enabled. It is important to know that all changes made to the MapServer are stateless and only valid for the duration of the call. One the call is process, MapServer is reverted back to the original state.
Reordering layers: When HonorLayerReordering is set to True, the position of a LayerDescription in the LayerDescriptions becomes important. The LayerDescription of the top of the array draws on top of any other layer in a mapervice, the last one in the array is drawn at the bottom.
Modify layer symbol: Set DrawingDescription to an existing LayerDescription to modify how a layer will be drawn. Setting this to Null on an existing LayerDescription makes the layer draw with the renderer set in the source map document. MapServer supports Simple, ClassBreaks and UniqueValue renderers. GenerateDataClasses is a helper method that can be used to ask a mapservice to generate ClassBreaks or UniqueValue renderer.
Add new layer: A new layer can only be added when a workspace (of type ArcSDE, FileGeodatabase or folder) is registered with a mapservice. One needs to consult with the publisher to find out whether any workspace is registered to a mapervice and what is identifier for that workspace. A mapservice does not advertise what are the workspace registered with itself. In order add a new layer dynamically, create a LayerDescription, set the Source and DrawingDescription properties, set Visible to True, LayerID should be set to a positive integer that is not used by any other LayerDescription and add it to the LayerDescriptions property of MapDescription. HonorLayerReordering property must be set to True.
Exporting from a cached map service
By default Exporting a map from a cached service does not generate map dynamically, instead it creates map using pre-cooked cache tiles and return one single image instead of multiple tiles. What that also means that any changes made to the LayerDescription of any of the map layers, such as applying a definition expression, applying a selection buffer, toggling the visibility of labels or changing the visibility of the layer itself are ignored. Also, any changes made to the database does not get relected since tiles are all precooked. In addition, custom graphics, the rendering of selected features etc. cannot be applied to the MapDescription.
By contrast, when a cached mapservice is enabled with dynamicLayers, an ExportMapImage call generates map dynamically by reading database instead of using pre-cooked tiles. As a result, any changes made to the LayerDescription or the source database are reflected in the output image.
Exporting image from a cached map service may be useful for getting the image in a different coordinate system other than the mapservice's.
Miscellaneous
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.
mapDesc
- A reference to a com.esri.arcgis.carto.IMapDescription (in)imageDesc
- A reference to a com.esri.arcgis.carto.IImageDescription (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IMapServerFindResults find(IMapDescription mapDesc, IImageDisplay mapImage, String searchString, boolean contains, String searchFields, int option, ILongArray layerIds) throws IOException, AutomationException
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.
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.
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 ILayerDescription3) or whether the layer is on, but not visible due to scale dependencies (the MinScale and MaxScale properties on IMapLayerInfo2). 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.
In order to control the amount of information MapServer needs to process for a query, a maximum number of records can be set. This value is contained in the MaxRecordCount property on IMapServerInit2. The default value for this property is 1,000. If 1,100 features match a given query only the first 1,000 results will be returned. You will be unable to access the remaining 100 records. To be able to access these records the MaxRecordCount would need to be increased to 1,100. MaxRecordCount can also be changed by modifying the MaxRecordCount XML tag in the MapServer's configuration file.
mapDesc
- A reference to a com.esri.arcgis.carto.IMapDescription (in)mapImage
- A reference to a com.esri.arcgis.carto.IImageDisplay (in)searchString
- The searchString (in)contains
- The contains (in)searchFields
- The searchFields (in)option
- A com.esri.arcgis.carto.esriFindOption constant (in)layerIds
- A reference to a com.esri.arcgis.system.ILongArray (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IMapServerIdentifyResults identify(IMapDescription mapDesc, IImageDisplay mapImage, IGeometry searchShape, int tolerance, int option, ILongArray layerIds) throws IOException, AutomationException
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. You need to use HTMLPopup property to get the result in html format.
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.
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:
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 ILayerDescription3) or whether the layer is on, but not visible due to scale dependencies (the MinScale and MaxScale properties on IMapLayerInfo2). 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
In order to control the amount of information MapServer needs to process for a query, a maximum number of records can be set. This value is contained in the MaxRecordCount property on IMapServerInit2. The default value for this property is 1000. If 1,100 features match a given query only the first 1,000 results will be returned. You will be unable to access the remaining 100 records. To be able to access these records the MaxRecordCount would need to be increased to 1,100. MaxRecordCount can also be changed by modifying the MaxRecordCount XML tag in the MapServer's configuration file.
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. The number of rows returned is not limited by MaxRecordCount.
mapDesc
- A reference to a com.esri.arcgis.carto.IMapDescription (in)mapImage
- A reference to a com.esri.arcgis.carto.IImageDisplay (in)searchShape
- A reference to a com.esri.arcgis.geometry.IGeometry (in)tolerance
- The tolerance (in)option
- A com.esri.arcgis.carto.esriIdentifyOption constant (in)layerIds
- A reference to a com.esri.arcgis.system.ILongArray (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.int queryFeatureCount(String mapName, int layerID, IQueryFilter filter) throws IOException, AutomationException
QueryFeatureCount returns the number of map features that match the parameters of a given query filter.
QueryFeatureCount requires a number of input parameters. These include: a MapName, LayerID, and a QueryFilter. The QueryFilter can be an attribute query (SQL espression), a spatial query, or a combination of both.
QueryFilter
QueryFilter provides the ability to query based on attribute filter (SQL expression) a spatial filter, or a combination of both. Attribute filters take any valid ‘non-GIS data specific’ SQL statement. For example, CNTRY_CODE = ‘BD’ or POPULATION = 12345. Syntax for querying date fields depend on the underlying data. If you are working with Shapefile or File GeoDatabase data the syntax is <FieldName> = date ‘YYYY-MM-DD’; for Access-based Personal GeoDatabase the sytax is #YYYY-MM-DD#. For SDE database, check with the specific database’s help.
SearchShape
Geometry set in ISpatialFilter should meet the following criteria:
Miscellaneous
MaxRecordCount does not affect QueryFeatureCount or QueryFeatureCount2.
There are two key differences between Find and QueryFeatureCount. 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.
mapName
- The mapName (in)layerID
- The layerID (in)filter
- A reference to a com.esri.arcgis.geodatabase.IQueryFilter (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IFIDSet queryFeatureIDs(String mapName, int layerID, IQueryFilter filter) throws IOException, AutomationException
QueryFeatureIDs returns the IDs (FIDSet) of map features that match the parameters of a given query filter. FIDSet is always a sorted list of integers, therefore ORDER BY has no effects. Use QueryRowIDs if the result needs to be sorted by fields other than ObjectID field.
QueryFeatureIDs requires a number of input parameters. These include: a MapName, LayerID, and a QueryFilter. The QueryFilter can be an attribute query (SQL espression), a spatial query, or a combination of both.
QueryFilter
QueryFilter provides the ability to query based on attribute filter (SQL expression) a spatial filter, or a combination of both. Attribute filters take any valid ‘non-GIS data specific’ SQL statement. For example, CNTRY_CODE = ‘BD’ or POPULATION = 12345. Syntax for querying date fields depend on the underlying data. If you are working with Shapefile or File GeoDatabase data the syntax is <FieldName> = date ‘YYYY-MM-DD’; for Access-based Personal GeoDatabase the sytax is #YYYY-MM-DD#. For SDE database, check with the specific database’s help.
SearchShape
Geometry set in ISpatialFilter should meet the following criteria:
Miscellaneous
MaxRecordCount does not affect QueryFeatureIDs or QueryFeatureIDs2.
There are two key differences between Find and QueryFeatureIDs. 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.
The results of this function can be used with LayerDescription::SelectionFeatures to display the selection in the exported image.
mapName
- The mapName (in)layerID
- The layerID (in)filter
- A reference to a com.esri.arcgis.geodatabase.IQueryFilter (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IRecordSet queryFeatureData(String mapName, int layerID, IQueryFilter filter) throws IOException, AutomationException
QueryFeatureData returns the records of map features that match the parameters of a given query filter. QueryFeatureData returns a RecordSet .
QueryFeatureData requires a number of input parameters. These include: a Name, LayerID, and a QueryFilter. The QueryFilter can be an attribute query (SQL espression), a spatial query, a combination of both or null.
QueryFilter
QueryFilter provides the ability to query based on attribute filter (SQL expression) a spatial filter, or a combination of both. Attribute filters take any valid ‘non-GIS data specific’ SQL statement. For example, CNTRY_CODE = ‘BD’ or POPULATION = 12345. Syntax for querying date fields depend on the underlying data. If you are working with Shapefile or File GeoDatabase data the syntax is <FieldName> = date ‘YYYY-MM-DD’; for Access-based Personal GeoDatabase the sytax is #YYYY-MM-DD#. For SDE database, check with the specific database’s help.
It can be set to null or Nothing to retrieve all data (which is also limited by MaxRecordCount)
If geometry is not desired in the output RecordSet, IQuerFilter’s SubFields must be defined without ‘Shape’ field. When SubFields is empty or includes ‘Shape’, IRecordSet will include the fields "shape_length" and "shape_area". If the desired spatial reference of the output geometry is different than the original one, OutputSpatialReference should be used. Otherwise geometry is returned in the same spatial reference system as the DefaultMapDescription by default. When SubFields is not defined or = “*”, it returns all visible fields. Invisible or invalid field names or field aliases must not be included in SubField’s string or it will return an error. Please note ObjectID field is always returned regardless of whether it is in the SubFields or not. Only expection is when DISTINCT is used.
SearchShape
Geometry set in ISpatialFilter should meet the following criteria:
Results
QueryFeatureData honors field visibility set in the source map document. Field aliases, set in the source map document, are honored only when working with the MapServer WSDL or accessing a MapServer object through an AGSServerConnection (LAN or internet), but not honored for DCOM connection. However, the RecordSet does NOT honor any field formatting set in the source map.
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, unless OutputSpatialReference is explicitly set to another coordinate system by the user (for SOAP/WSDL, both OutputSpatialReference & SpatialReferenceFieldName properties must be set). To get the coordinate system, IField::GeometryDef should be used.
In some cases, may be for performance reasons, you may want to limit or adjust the geometry being returned in the record set result. You cannot adjust returned geometry using QueryFeatureData. You will need to use QueryFeatureData2 in order to do this.
In order to control the amount of information MapServer needs to process for a query, a maximum number of records can be set. This value is contained in the MaxRecordCount property on IMapServerInit2. The default value for this property is 500. If 600 features match a given query only the first 500 results will be returned. You will be unable to access the remaining 100 records. To be able to access these records the MaxRecordCount would need to be increased to 600. MaxRecordCount can also be changed by modifying the MaxRecordCount XML tag in the MapServer's configuration file.
Miscellaneous
There are two key differences between Find and QueryFeatureData. 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.
mapName
- The mapName (in)layerID
- The layerID (in)filter
- A reference to a com.esri.arcgis.geodatabase.IQueryFilter (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IMapServerHyperlinks queryHyperlinks(IMapDescription mapDesc, IImageDisplay mapImage, ILongArray layerIds) throws IOException, AutomationException
QueryHyperlinks returns a collection of objects that implement IMapServerHyperlink.
QueryHyperlinks requires a number of input parameters. These include: a MapDescription, ImageDisplay, and LayerID.
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 QueryHyperlinks results should honor any definition query or DefinitionExpression set on the layer.
This is needed to determine whether layers are visible or not based on the current map scale. Layer visibility depends on whether the layer is on or off (the Visible property on ILayerDescription3) or whether the layer is on, but not visible due to scale dependencies (the MinScale and MaxScale properties on IMapLayerInfo2).
Miscellaneous
In some cases, for performance reasons, you may want to adjust the geometry being returned in the QueryHyperlink result. Use ILayerResultOptions to manage this. You can 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. Setting IncludeGeometry property has no effect, QueryHyperLinks always returns geometry.
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.
In order to control the amount of information MapServer needs to process for a query, a maximum number of records can be set. This value is contained in the MaxRecordCount property on IMapServerInit2. The default value for this property is 500. If 600 features match a given query only the first 500 results will be returned. You will be unable to access the remaining 100 records. To be able to access these records the MaxRecordCount would need to be increased to 600. MaxRecordCount can also be changed by modifying the MaxRecordCount XML tag in the MapServer's configuration file.
mapDesc
- A reference to a com.esri.arcgis.carto.IMapDescription (in)mapImage
- A reference to a com.esri.arcgis.carto.IImageDisplay (in)layerIds
- A reference to a com.esri.arcgis.system.ILongArray (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.double computeScale(IMapDescription mapDesc, IImageDisplay mapDisplay) throws IOException, AutomationException
mapDesc
- A reference to a com.esri.arcgis.carto.IMapDescription (in)mapDisplay
- A reference to a com.esri.arcgis.carto.IImageDisplay (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.double computeDistance(String mapName, IPoint fromPoint, IPoint toPoint, int units) throws IOException, AutomationException
mapName
- The mapName (in)fromPoint
- A reference to a com.esri.arcgis.geometry.IPoint (in)toPoint
- A reference to a com.esri.arcgis.geometry.IPoint (in)units
- A com.esri.arcgis.system.esriUnits constant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IPointCollection toMapPoints(IMapDescription mapDescription, IImageDisplay mapDisplay, ILongArray screenXValues, ILongArray screenYValues) throws IOException, AutomationException
mapDescription
- A reference to a com.esri.arcgis.carto.IMapDescription (in)mapDisplay
- A reference to a com.esri.arcgis.carto.IImageDisplay (in)screenXValues
- A reference to a com.esri.arcgis.system.ILongArray (in)screenYValues
- A reference to a com.esri.arcgis.system.ILongArray (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.void fromMapPoints(IMapDescription mapDescription, IImageDisplay mapDisplay, IPointCollection mapPoints, ILongArray[] screenXValues, ILongArray[] screenYValues) throws IOException, AutomationException
mapDescription
- A reference to a com.esri.arcgis.carto.IMapDescription (in)mapDisplay
- A reference to a com.esri.arcgis.carto.IImageDisplay (in)mapPoints
- A reference to a com.esri.arcgis.geometry.IPointCollection (in)screenXValues
- A reference to a com.esri.arcgis.system.ILongArray (in/out: use single element array)screenYValues
- A reference to a com.esri.arcgis.system.ILongArray (in/out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IMapServerLegendInfos getLegendInfo(String mapName, ILongArray layerIds, IMapServerLegendPatch patch, IImageType imgType) throws IOException, AutomationException
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.
mapName
- The mapName (in)layerIds
- A reference to a com.esri.arcgis.system.ILongArray (in)patch
- A reference to a com.esri.arcgis.carto.IMapServerLegendPatch (in)imgType
- A reference to a com.esri.arcgis.carto.IImageType (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ISQLSyntaxInfo getSQLSyntaxInfo(String mapName, int layerID) throws IOException, AutomationException
The members of the ISQLSyntaxInfo interface provide information regarding the SQL functionality for the DBMS underlying a map layer.
mapName
- The mapName (in)layerID
- The layerID (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.int getSupportedImageReturnTypes() throws IOException, AutomationException
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IImageResult exportScaleBar(IScaleBar scalebar, IMapDescription mapDesc, IImageDisplay pMapDisplay, IColor backgroundColor, IImageDescription imageDesc) throws IOException, AutomationException
Use ExportScaleBar to retrieve the map's scale bar. To customize the scale bar pass in a ScaleBar object. If you pass in Nothing/Null for the input paramter ScaleBar, a default alternating scale bar is drawn. The scale is calculated according to the height and width of the the image (pMapDisplay). This ImageDisplay object refers to the map. Another ImageDisplay object will be used (as part of the imageDesc parameter) that refers to the Scale Bar image. A color background can be set for the ScaleBar swatch by using the backgroundColor parameter. If this is Nothing/Null a white background will be used. Use TransparentColor in IImageDisplay2 if you want the background to be transparent. Size, resolution and file format are determined by ImageDescription, which includes ImageDisplay and ImageType. ExportScaleBar returns an ImageResult object.
Use the height and width properties of IImageDisplay (as part of the imageDesc parameter) to set the proper size of the scalebar. Entering a 0 for either the height or the width for ExportScaleBar output results in an error.
scalebar
- A reference to a com.esri.arcgis.carto.IScaleBar (in)mapDesc
- A reference to a com.esri.arcgis.carto.IMapDescription (in)pMapDisplay
- A reference to a com.esri.arcgis.carto.IImageDisplay (in)backgroundColor
- A reference to a com.esri.arcgis.display.IColor (in)imageDesc
- A reference to a com.esri.arcgis.carto.IImageDescription (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.int queryFeatureCount2(String mapName, ILayerDescription pLayerDescription, IQueryFilter filter) throws IOException, AutomationException
Note: this has been superceded by QueryRowCount.
QueryFeatureCount2 returns the number of map features that match the parameters of a given query filter.
QueryFeatureCount2 requires a number of input parameters. These include: a MapName, LayerDescription and a QueryFilter. The QueryFilter can be an attribute query (SQL espression), a spatial query, or a combination of both.
QueryFilter
QueryFilter provides the ability to query based on attribute filter (SQL expression) a spatial filter, or a combination of both. Attribute filters take any valid ‘non-GIS data specific’ SQL statement. For example, CNTRY_CODE = ‘BD’ or POPULATION = 12345. Syntax for querying date fields depend on the underlying data. If you are working with Shapefile or File GeoDatabase data the syntax is <FieldName> = date ‘YYYY-MM-DD’; for Access-based Personal GeoDatabase the sytax is #YYYY-MM-DD#. For SDE database, check with the specific database’s help.
SearchShape
Geometry set in ISpatialFilter should meet the following criteria:
DefinitionExpressions
A DefinitionExpression can be set on a layer in order to limit layer features available for display or query. This expression can be also be set in the source map document as a definition query. Any DefinitionExpression set in the LayerDescription will override any definition query set in the source map. MapServer QueryFeatureCount2 honors DefinitionExpression.
Let's look at some examples. You have a layer in your map that represents sales regions. The layer includes fields REGIONS, SALES and MANAGER.
Example #1: In the source map the layer has a definition query, "REGION = 'North'". No DefintionExpression is specified in LayerDescription. Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be a count of all sale region features that fall within the North region and are managed by Bob.
Example #2: In the source map the layer has a definition query, "REGION = 'North'". You apply a DefinitionExpression in LayerDescription as "SALES > 1000". Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be a count of all sale region features with sales over 1000 and are managed by Bob. QueryFeatureCount2 honors the DefinitionExpression set in LayerDescription. The DefinitionExpression overrides the definition query set in the source map. If you wish to include the layer's original defintion query, "REGION = 'North'" in your final query, you must include this in your QueryFilter, ""MANAGER = 'Bob' AND "REGION = 'North'".
Example #3: In the source map the layer has no definition query. You apply a DefinitionExpression in LayerDescription as "SALES > 1000". Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be a count of all sale region features with sales over 1000 and are managed by Bob. QueryFeatureCount2 honors the DefinitionExpression set in LayerDescription.
Miscellaneous
MaxRecordCount does not affect QueryFeatureCount or QueryFeatureCount2.
There are two key differences between Find and QueryFeatureCount2. 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.
mapName
- The mapName (in)pLayerDescription
- A reference to a com.esri.arcgis.carto.ILayerDescription (in)filter
- A reference to a com.esri.arcgis.geodatabase.IQueryFilter (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IFIDSet queryFeatureIDs2(String mapName, ILayerDescription pLayerDesciscription, IQueryFilter filter) throws IOException, AutomationException
QueryFeatureIDs2 returns the IDs (FIDSet) of map features that match the parameters of a given query filter.
QueryFeatureIDs2 requires a number of input parameters. These include: a MapName, LayerDescription, and a QueryFilter. The QueryFilter can be an attribute query (SQL espression), a spatial query, or a combination of both.
QueryFilter
QueryFilter provides the ability to query based on attribute filter (SQL expression) a spatial filter, or a combination of both. Attribute filters take any valid ‘non-GIS data specific’ SQL statement. For example, CNTRY_CODE = ‘BD’ or POPULATION = 12345. Syntax for querying date fields depend on the underlying data. If you are working with Shapefile or File GeoDatabase data the syntax is <FieldName> = date ‘YYYY-MM-DD’; for Access-based Personal GeoDatabase the sytax is #YYYY-MM-DD#. For SDE database, check with the specific database’s help.
SearchShape
Geometry set in ISpatialFilter should meet the following criteria:
DefinitionExpressions
A DefinitionExpression can be set on a layer in order to limit layer features available for display or query. This expression can be also be set in the source map document as a definition query. Any DefinitionExpression set in the LayerDescription will override any definition query set in the source map. MapServer QueryFeatureIDs2 honors DefinitionExpression.
Let's look at some examples. You have a layer in your map that represents sales regions. The layer includes fields REGIONS, SALES and MANAGER.
Example #1: In the source map the layer has a definition query, "REGION = 'North'". No DefintionExpression is specified in LayerDescription. Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be the ids of all sale region features that fall within the North region and are managed by Bob.
Example #2: In the source map the layer has a definition query, "REGION = 'North'". You apply a DefinitionExpression in LayerDescription as "SALES > 1000". Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be the ids of all sale region features with sales over 1000 and are managed by Bob. QueryFeatureIDs2 honors the DefinitionExpression set in LayerDescription. The DefinitionExpression overrides the definition query set in the source map. If you wish to include the layer's original defintion query, "REGION = 'North'" in your final query, you must include this in your QueryFilter, ""MANAGER = 'Bob' AND "REGION = 'North'".
Example #3: In the source map the layer has no definition query. You apply a DefinitionExpression in LayerDescription as "SALES > 1000". Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be the ids of all sale region features with sales over 1000 and are managed by Bob. QueryFeatureIDs2 honors the DefinitionExpression set in LayerDescription.
Miscellaneous
MaxRecordCount does not affect QueryFeatureIDs or QueryFeatureIDs2.
There are two key differences between Find and QueryFeatureIDs2. 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.
The results of this function can be used with LayerDescription::SelectionFeatures to display the selection in the exported image.
mapName
- The mapName (in)pLayerDesciscription
- A reference to a com.esri.arcgis.carto.ILayerDescription (in)filter
- A reference to a com.esri.arcgis.geodatabase.IQueryFilter (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IQueryResult queryFeatureData2(String mapName, ILayerDescription pLayerDesciscription, IQueryFilter filter, IQueryResultOptions options) throws IOException, AutomationException
Note: this has been superceded by QueryData.
QueryFeatureData2 returns the records of map features that match the parameters of a given query filter. QueryFeatureData2 returns a QueryResult. A QueryResult format can be either KML or a RecordSet. The Format of the QueryResult is specified in QueryResultOptions. QueryResultOptions can also be used to specify a GeoTransformation if one is needed.
QueryFeatureData2 requires a number of input parameters. These include: a Name, LayerDescription and a QueryFilter. The QueryFilter can be an attribute query (SQL espression), a spatial query, a combination of both or null. ILayerDescription2 has SourceID property that can be used to query against a GP result.
QueryFilter
QueryFilter provides the ability to query based on attribute filter (SQL expression) a spatial filter, or a combination of both. Attribute filters take any valid ‘non-GIS data specific’ SQL statement. For example, CNTRY_CODE = ‘BD’ or POPULATION = 12345. Syntax for querying date fields depend on the underlying data. If you are working with Shapefile or File GeoDatabase data the syntax is <FieldName> = date ‘YYYY-MM-DD’; for Access-based Personal GeoDatabase the sytax is #YYYY-MM-DD#. For SDE database, check with the specific database’s help.
It can be set to null or Nothing to retrieve all data (which is also limited by MaxRecordCount)
If geometry is not desired in the output RecordSet, IQuerFilter’s SubFields must be defined without ‘Shape’ field. When SubFields is empty or includes ‘Shape’, IRecordSet will include the fields "shape_length" and "shape_area". If the desired spatial reference of the output geometry is different than the original one, OutputSpatialReference should be used. Otherwise geometry is returned in the same spatial reference system as the DefaultMapDescription by default. When SubFields is not defined or = “*”, it returns all visible fields. Invisible or invalid field names or field aliases must not be included in SubField’s string or it will return an error. Please note ObjectID field is always returned regardless of whether it is in the SubFields or not. Only expection is when DISTINCT is used.
SearchShape
Geometry set in ISpatialFilter should meet the following criteria:
DefinitionExpressions
A DefinitionExpression can be set on a layer in order to limit layer features available for display or query. This expression can be also be set in the source map document as a definition query. Any DefinitionExpression set in the LayerDescription will override any definition query set in the source map. MapServer QueryFeatureData2 honors DefinitionExpression.
Let's look at some examples. You have a layer in your map that represents sales regions. The layer includes fields REGIONS, SALES and MANAGER.
Example #1: In the source map the layer has a definition query, "REGION = 'North'". No DefintionExpression is specified in LayerDescription. Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be all sale region features that fall within the North region and are managed by Bob.
Example #2: In the source map the layer has a definition query, "REGION = 'North'". You apply a DefinitionExpression in LayerDescription as "SALES > 1000". Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be all sale region features with sales over 1000 and are managed by Bob. QueryFeatureData2 honors the DefinitionExpression set in LayerDescription. The DefinitionExpression overrides the definition query set in the source map. If you wish to include the layer's original defintion query, "REGION = 'North'" in your final query, you must include this in your QueryFilter, ""MANAGER = 'Bob' AND "REGION = 'North'".
Example #3: In the source map the layer has no definition query. You apply a DefinitionExpression in LayerDescription as "SALES > 1000". Your QueryFilter where clause is "MANAGER = 'Bob'". The result will be all sale region features with sales over 1000 and are managed by Bob. QueryFeatureData2 honors the DefinitionExpression set in LayerDescription.
Results
The result can be returned in two formats: KML and RecordSet.
KML
When KML is the desired output, it is passed back as a URL (when QueryResultFormat is esriQueryResultKMLAsURL) or as a MIME object (when QueryResultFormat is esriQueryResultKMLAsMime). The file or Mime is returned in compressed KMZ format.
Setting LayerResultOptions has no effect on KML output.
RecordSet
When esriQueryResultRecordSetAsObject is selected as QueryResultFormat, the function returns RecordSet as an Object. Use IQueryResult::Object property to access that. The returned object needs to be QI to IRecordSet.
Result Geometry
By default, geometry is returned in the same spatial reference as the DefaultMapDescription. The spatial reference of QueryFeatureData2 results can be set to something different than the DefaultMapDescription by using OutputSpatialReference. OutputSpatialReference is a property of IQueryFilter. For SOAP/WSDL users, both OutputSpatialReference & SpatialReferenceFieldName properties are required and must be set.
In some instances the result may require a GeoTransformation . For example, a given map service may be using a spatial reference system based on GCS_WGS_1984. A client wants to display QueryFeatureData2 results based on this map service in a different spatial reference, GCS_European_1950. The results will use the spatial reference of the DefaultMapDescription, GCS_WGS_1984, and display these results incorrectly in GCS_European_1950. Features may not "line up" correctly. In order to correctly display these results a GeoTransformation is needed. Applying the correct GeoTransformation ensures the spatial correctness of the result.
Another instance where a GeoTransformation may be need to be specified in the QueryResultsOption is if the queried layer is projected on the fly within the map service. That is, the coordinate system of the layer's source is different than the DefaultMapDescription coordinate system, and no appropriate transformation has been set in the map document before serving. In this case, you can access the coordinate system of a layer source by first getting the layer's MapLayerInfo, then get Fields from MapLayerInfo, get the Shape Field from Fields, get GeometryDef from Field, and finally, get the SpatialReference from GeometryDef.
A GeoTransformation is not needed if the projected coordinate systems share the same underlying geographic coordinate system. For best results it is optimal for data (layers within the map service), map service and MapServer output to use the same coordinate system.
In some cases, may be for performance reasons, you may want limit or adjust the geometry being returned in the record set result. Use ILayerResultOptions to manage this. If IncludeGeometry is set to False, geometry is not included in the recordset. This should increase performance in cases where feature geometry is large. 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.
Field visibility and field aliases
QueryFeatureData2 honors field visibility and field aliases set in the source map document. However, the RecordSet does NOT honor any field formatting set in the source map.
Miscellaneous
In order to control the amount of information MapServer needs to process for a query, a maximum number of records can be set. This value is contained in the MaxRecordCount property on IMapServerInit2. The default value for this property is 500. If 600 features match a given query only the first 500 results will be returned. You will be unable to access the remaining 100 records. To be able to access these records the MaxRecordCount would need to be increased to 600. MaxRecordCount can also be changed by modifying the MaxRecordCount XML tag in the MapServer's configuration file.
There are two key differences between Find and QueryFeatureData2. 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.
Precedence. In case where both IQueryFilter::SubField and ILayerResultOption::IncludeGeometry is set, SubField takes precedence over IncludeGeometry. For example, when SubField = “Shape, FName, LName, Address” and IncludeGeometry = False, the output recordset will contain geometry as contained within the Shape field.
mapName
- The mapName (in)pLayerDesciscription
- A reference to a com.esri.arcgis.carto.ILayerDescription (in)filter
- A reference to a com.esri.arcgis.geodatabase.IQueryFilter (in)options
- A reference to a com.esri.arcgis.carto.IQueryResultOptions (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IPropertySet getServiceConfigurationInfo() throws IOException, AutomationException
Use ServiceConfigurationInfo to get restrictions set for a map service by the publisher that are stored in map service configuration file (.cfg). This property returns a PropertySet. This PropertySet includes: MaximumRecordCount, MaximumBufferCount, MaximumImageWidth, MaximumImageHeight and SupportedImageFormatTypes .
Image formats supported by optimized MapServices are “PNG32, PNG24, PNG, JPG, DIB, TIFF , EMF, PS, PDF, GIF, SVG, SVGZ” and by standard MapServices are “PNG24, PNG, JPG, DIB, TIFF, EMF, PS, PDF, GIF, SVG, SVGZ, AI”.
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |