You are here: > ESRI Forums > arcgis explorer discussion forums > Thread Replies

ArcGIS Explorer Discussion Forums

ArcGIS Explorer: SDK Developers forum

Query a Service Layer in ArcGIS Explorer   Mohamed Adel Mohamedy Oct 22, 2009
Re: Query a Service Layer in ArcGIS Explore...   Mike Branscomb Oct 23, 2009
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Query a Service Layer in ArcGIS Explorer 
Author Mohamed Adel Mohamedy 
Date Oct 22, 2009 
Message How can i query attribute data from a Service Layer come from ArcGIS Server Map Service in ArcGIS Explorer?

i tried to Access its names only by the following code , but i cant convert it to feature layer

ESRI.ArcGISExplorer.Application.SelectedItemsCollection selItems = ESRI.ArcGISExplorer.Application.Application.SelectedItems;

ServiceLayer sLayer = selItems[0] as ServiceLayer;

ServiceChildLayer scLayer = sLayer.ChildItems[0] as ServiceChildLayer;


Thanks in Advance
 
  ------------------------
Mohamed Adel Mohamedy
Training Department , QSIT
+2 010 652 4 850
ESRI Northeast Africa  
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Query a Service Layer in ArcGIS Explorer 
Author Mike Branscomb 
Date Oct 23, 2009 
Message Mohamed,

Unfotunately you cannot currently query a ServiceLayer directly in this way although a something along these lines is already logged as an enhancement request. You will need to use the SOAP or REST API of the ServiceLayer that you would like to query.

My recommended approach would be:

1. Visit the ArcGIS Server SOAP SDK documentation and read some of the intro docs.

2. Go to the section on proxy libraries(http://resources.esri.com/help/9.3/arcgisserver/apis/soap/Pre-generated_proxies.htm) then follow the instructions "To use in your .NET Framework application project:...".

3. Write some code like that in the code section of this reply which queries the service. This example actually calls an Identify operation on the service but there are also other operations such as QueryFeatureData.

N.B. To get the URL for your service you'll need to append some additional info e.g.:

MapServerProxy mapServerProxy = new MapServerProxy();

mapServerProxy.URL = Convert.ToString(serviceLayer.ServiceConnectionProperties.Url)
+ serviceLayer.ServiceConnectionProperties.ServiceName + "/MapServer";

I hope this provides sufficient information to help you query ServiceLayers from your AddIn.

Regards

Mike 
 
//Set the URL property of the MapServerProxy object
          mapServerProxy.Url = serviceURL;

          //Get the MapServerInfo
          MapServerInfo mapServerInfo = mapServerProxy.GetServerInfo(mapServerProxy.GetDefaultMapName());

          //Get the MapDescription
          MapDescription mapDescription = mapServerInfo.DefaultMapDescription;

          //Project the point into the coord sys of the MapService
          if (inputPoint.CoordinateSystem.Id != mapDescription.SpatialReference.WKID)
          {
            //Create an instance of the CoordinateSystem to project the Point into.
            CoordinateSystem projectInto = new CoordinateSystem(mapDescription.SpatialReference.WKID);

            //Project the point
            inputPoint = GeometryOperations.Project(inputPoint, projectInto) as ESRI.ArcGISExplorer.Geometry.Point;
            
            //If the Project() failed exit
            if (inputPoint == null) return;
          }

          //Create an Image Display to pass into the Identify operation
          ImageDisplay imageDisplay = new ImageDisplay();
          
          //Get the geometry:
          //Convert from an Explorer point to a SOAP PointN with GeometryToSoap<Explorer Type, SOAP Type>.
          ESRI.ArcGIS.SOAP.PointN inputSoapPointN =
            SoapConverter.GeometryToSoap<ESRI.ArcGISExplorer.Geometry.Point, ESRI.ArcGIS.SOAP.PointN>(inputPoint);

          //Call the Identify() operation
          MapServerIdentifyResult[] mapServerIdentifyResults = mapServerProxy.Identify(
            mapDescription,
            imageDisplay,
            inputSoapPointN,
            1,
            esriIdentifyOption.esriIdentifyAllLayers,
            null);
 
  Mike Branscomb
ESRI - ArcGIS Explorer Team