Map service QueryHyperlinks method
Queries and returns feature geometry and associated hyperlink URL for visible layers within a defined map extent.
QueryHyperlinks(MapDescription MapDescription, ImageDisplay MapImageDisplay, int[ ] LayerIDs)
Parameter |
Description |
---|---|
MapDescription |
Used to define the map extent and visibility of layers. |
ImageDisplay |
Used to determine whether layers are visible or not based on the current map scale. |
LayerIDs |
An array of layers ids for layers to search. Only visible layers are searched. If empty or null, all layers can be searched. |
Return Value
An array of MapServerHyperlink objects, one for each feature that has a hyperlink URL. These objects store the feature geometry and the URL.
Remarks
A feature layer within a map service must enable hyperlinks by specifying the field that contains the hyperlink URL. No validation is done to ensure that the field contains a URL, thus any string value can be provided. As a result, the hyperlink field can contain a raw URL ("http://www.esri.com") or the HTML representation of a URL("<a href='http://www.esri.com'>ESRI</a>"). If a feature layer has enabled hyperlinks and the field containing the hyperlink content is empty, no MapServerHyperlink object will be returned.
Layer visibility depends on whether the layer is on or off (the Visible property on a layers LayerDescription) or whether the layer is on, but not visible due to scale dependencies. Each layer maintains a LayerDescription available via the MapDescription.LayerDescriptions array. Scale dependency for a layer is available via the MinScale and MaxScale properties on MapLayerInfo, available via the MapServerInfo.MapLayerInfos array. The ImageDisplay parameter is used to determine layer visibility based on scale dependencies.
The amount of information (e.g. number of MapServerHyperlink objects) returned from a call to the this method may be restricted by the map service. The default maximum value for the number of results returned is 500. If 600 records are matched, only the first 500 results will be returned. You will be unable to access the remaining 100 records. The maximum number of results cannot be changed via the ArcGIS Server SOAP API. The map service itself must be configured to return more results, if necessary.
Examples
C#
MapService_MapServer mapservice = new MapService_MapServer();
mapservice.Url = "http://localhost:6080/arcgis/services/MapService/MapServer";
string mapname = mapservice.GetDefaultMapName();
MapServerInfo mapinfo = mapservice.GetServerInfo(mapservice.GetDefaultMapName());
MapDescription mapdesc = mapinfo.DefaultMapDescription;
ImageDisplay imgdisp = new ImageDisplay();
imgdisp.ImageHeight = 500; //pixels
imgdisp.ImageWidth = 500; //pixels
imgdisp.ImageDPI = 96;
LayerDescription[] layerdescriptions = mapdesc.LayerDescriptions;
int[] layerids = new int[layerdescriptions.Length];
int i = 0;
foreach (LayerDescription layerdesc in layerdescriptions)
{
layerids.SetValue(layerdesc.LayerID, i++);
}
MapServerHyperlink[] hyperlinkresults = mapservice.QueryHyperlinks(mapdesc, imgdisp, layerids);
VB.NET
Dim mapservice As MapService_MapServer = New MapService_MapServer()
mapservice.Url = "http://localhost:6080/arcgis/services/MapService/MapServer"
Dim mapname As String = mapservice.GetDefaultMapName()
Dim mapinfo As MapServerInfo = mapservice.GetServerInfo(mapservice.GetDefaultMapName())
Dim mapdesc As MapDescription = mapinfo.DefaultMapDescription
Dim imgdisp As ImageDisplay = New ImageDisplay()
imgdisp.ImageHeight = 500 'pixels
imgdisp.ImageWidth = 500 'pixels
imgdisp.ImageDPI = 96
Dim layerdescriptions() As LayerDescription = mapdesc.LayerDescriptions
Dim layerids(layerdescriptions.Length - 1) As Integer
Dim i As Integer = 0
Dim layerdesc As LayerDescription
For Each layerdesc In layerdescriptions
layerids.SetValue(layerdesc.LayerID, i)
i = i + 1
Next
Dim hyperlinkresults as MapServerHyperlink() = mapservice.QueryHyperlinks(mapdesc, imgdisp,layerids)
Java
String serviceURL = "http://localhost:6080/arcgis/services/MapService/MapServer";
MapServerBindingStub mapService = new MapServerBindingStub(serviceURL);
String mapName = mapService.getDefaultMapName();
MapServerInfo mapInfo = mapService.getServerInfo(mapName);
MapDescription mapDesc = mapInfo.getDefaultMapDescription();
ImageDisplay imgDisp = new ImageDisplay();
imgDisp.setImageHeight(500); //Height of the image in pixels
imgDisp.setImageWidth(500); //Width of the image in pixels
imgDisp.setImageDPI(96);
LayerDescription[] layerDescriptions = mapDesc.getLayerDescriptions();
int[] layerIDs = new int[layerDescriptions.length];
int i = 0;
for (LayerDescription layerDesc : layerDescriptions)
{
layerIDs[i++] = layerDesc.getLayerID();
}
MapServerHyperlink[] hyperLinkResults = mapService.queryHyperlinks(mapDesc, imgDisp, layerIDs);
for (MapServerHyperlink hyperLinkResult : hyperLinkResults) {
System.out.println("Hyperlink URL: " + hyperLinkResult.getURL());
}