Bug: Setting filter after dynamically adding a layer sends a GET_IMAGE request instead of a GET_FEATURES request
If a Filter is set on a Feature Layer, ArcIMS Java Connector normally sends a GET_FEATURES request. However, if a layer is dynamically added to the map before applying the Filter object, it sends a GET_IMAGE request even though users are interested in getting attribute information and not a map image.
When a dynamic layer is added to the map, Java Connector sends a GET_IMAGE request.
In order to force Java Connector to send a GET_FEATURES request, the dynamic layer must be removed.
- Add a dynamic layer:
ShapeWorkspace shpw = new ShapeWorkspace();
Dataset data = new Dataset();
FeatureLayer fl = new FeatureLayer("topo", null, null);
- Apply the Filter object on the Feature layer:
Filter filter = new Filter();
fLayer = (FeatureLayer)map.getLayers().item(1);
- Call Map.refresh() to trigger the request, note that the request is GET_IMAGE because of the existence of the dynamic layer:
mapURL = map.getMapOutput().getURL();
- To send a GET_FEATURES request, remove the dynamic layer and its workspace:
- Call Map.refresh() again, this time the request is GET_FEATURES.
- The following is a complete sample code that can run with the 'SantaClara' service to add a new layer from 'sc_topoq24' shapefile that comes with the tutorial data. Click on the 'tract' layer to query features from this layer. GetFeatures.zip