From what I've heard till now:

1) ArcGIS from version 10.1 and forth will only support http connections: local connections will not be supported any longer.

2) The code

ESRI.ArcGIS.Carto.IMapServer iMapServer = (ESRI.ArcGIS.Carto.IMapServer)ctx.ServerObject;

or the code

ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal mfunct = (ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal)gisResource;
                ESRI.ArcGIS.Carto.IMapServer iMapServer = (ESRI.ArcGIS.Carto.IMapServer)mfunct.MapServer;

can't both work with an internet service connection because they require a local connection.

3) The ESRI.ArcGIS.ADF.Web.SpatialFilter object cannot be set to identify what kind of query I'd like to perform. I mean, with the ESRI.ArcGIS.Geodatabase.ISpatialFilter interface you can do something like

spatialFilter.SpatialRel = ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum.esriSpatialRelIntersects;

to specify what you want as result. SpatialFilter hasn't this feature. I need the ISpatialFilter spatial relationship feature.

4) If you put it all together, it figures out that you need an IMapServer-implementing object to perform the ISpatialFilter query

ESRI.ArcGIS.Geodatabase.IFIDSet fidSet = iMapServer.QueryFeatureIDs(mapDescription.Name, layerID, queryFilter);

So if you read back points 1 and 2... what am I supposed to do?

I've also asked this on the official forums but still no answers.

Please help because I'm getting crazy on this.


To perform a spatial query using ArcGIS Server you will want to look to the REST API. Specifically the query operation on the map or feature server service. Here is a link to the documentation.


This will allow you to perform a spatial query on any published feature layer. You can also specify the spatial relationship as a parameter to the query.

It appears you are writing a .NET application. I assume this is a web application but I am not certain. In any case you may want to look into the ArcGIS API for Silverlight for an example on how to use the query task.

I hope this helps.

  • Yes, I'm currently using ADF to create a web application – Marco A. Aug 15 '11 at 19:28
  • You may want to take a look at the ESRI ArcGIS 10 and 10.1 deprecation document if you have not already. You can find that here: downloads2.esri.com/support/TechArticles/… The Web ADFs are being phased out. The recommended path is to migrate applications to the Web APIs including JavaScript, Flex, and Silverlight. The answer I gave above will work for any Silverlight or WPF based applications. – Ryan Taylor Aug 15 '11 at 19:40
  • I'm deeply sorry but I need to work with ADF for now, because seems like we have an obsolete (and big) application :( – Marco A. Aug 15 '11 at 23:22

So what you can do is just use the webclient class to call the REST endpoint to get your answer. Just build your URL with the query parameters you need.

WebClient client = new WebClient();
string json = client.DownloadString("Url with query params");

//T is the type
T result = new T();

//You can use the serializer to convert it to an object that has the properties that   
//match the json result
var serializer = new DataContractJsonSerializer(typeof(T));
Byte[] bytes = Encoding.Unicode.GetBytes(json);
using (MemoryStream stream = new MemoryStream(bytes))
   result = serializer.ReadObject(stream) as T;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.