Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm struggling with using the ESRI SOAP api to perform a spatial filter against a layer with a datatype of 'Route Event Source'

Because the number of features returned by a single spatial query could easily exceed the configured ArcGIS server max, I first grab all the features Ids of the features within the selection envelope, and then retrieve the feature attributes in chunks.

No matter what I do, the array of Feature Ids returned by QueryFeatureIds is always empty. With the same SpatialFilter, though, I receive a correct count from QueryFeatureCount and I receive the correct records from QueryFeatureData.

Here's the test case that illustrates the problem I'm having. Am I missing something, or is that the intended behavior? (I've changed the selection envelope in the sample)

var proxy = new MapServerProxy("http://mymapserver/ArcGIS/services/myservice/MapServer");

var envelope = new EnvelopeN();
envelope.XMax = 100010.0;
envelope.XMin = 100000.0;
envelope.YMax = 200010.0;
envelope.YMin = 200000.0;

var spatialFilter = new SpatialFilter();
spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
spatialFilter.GeometryFieldName = "Shape";
spatialFilter.FilterGeometry = envelope;

int routeEventLayerIndex = 0;
var count = proxy.QueryFeatureCount("Layers", routeEventLayerIndex, spatialFilter);
Assert.AreEqual(2, count); // PASSES, 2 features within envelope

var records = proxy.QueryFeatureData("Layers", routeEventLayerIndex, spatialFilter);
Assert.AreEqual(2, records.Records.Length); // PASSES, data for 2 features is returned

var fidSet = proxy.QueryFeatureIDs("Layers", routeEventLayerIndex, spatialFilter);
Assert.AreEqual(2, fidSet.FIDArray.Length); // FAILS!!! Length of FIDArray is 0

Edit
I've tested this against ArcGIS Server 10.0 and 10.0 sp 4; both return the same results.

share|improve this question
    
When you created the route event layer did you assign it an ObjectID field? To test, try using the select tool in arcmap. "Not all types of tables have an ObjectID field. When such tables are used by Make Route Event Layer, the resulting layer will not be selectable and cannot be used effectively by certain geoprocessing operations. Consider using Make Query Table prior to Make Route Event Layer to add a virtual ObjectID field." From the help. –  Kirk Kuykendall Apr 4 '12 at 0:51
    
Kirk - I didn't create the layer, so I'm not sure what process was used; I'm going to try and find out. I have verified, though, that the points on the route event layer are selectable in ArcMap. –  shrichards Apr 6 '12 at 1:14
    
Try assigning a spatial reference to the envelope. Also, did you try with the REST API? –  Kirk Kuykendall Apr 6 '12 at 2:20

1 Answer 1

I don't have the server API, but the below code might work..

IFIDSet fdset = new FIDSet();
fdset = proxy.QueryFeatureIDs("Layers", routeEventLayerIndex, spatialFilter);
debug.print fdset.Count;
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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