Quantcast
Channel: Forums - ArcGIS Viewer for Flex
Viewing all articles
Browse latest Browse all 2097

Query results degrade panning performance

$
0
0
I have an operational layer with about 20,000 points coming from a sublayer of a map server:

http://myserver/ArcGIS/rest/services...ta/MapServer/0

I also have a custom widget that will run a query against that same feature layer and add the returned features as graphics to a graphics layer that is created when the widget initializes. Technically the user could ask the widget to give them back all 20k points. If they do this, or even get back 5k records, the panning performance is incredibly degraded.

The question:
Why can I have all 20k features visible from the operational layer with normal panning, but adding even a quarter of them as query results degrades panning to an almost unusable state?

Here is the code that creates the graphics layer:
Code:

                        private function init():void
                        {
                                // build the layer to hold the graphics
                                graphicsLayer = new GraphicsLayer();
                                graphicsLayer.visible = false;
                                graphicsLayer.renderer = new SimpleRenderer(mySymbol);
                                map.addLayer(graphicsLayer);

                                // get output fields from the config file
                                popupfields = configXML.popup.fields.field;
                                popuptitle = configXML.popup.title;
                               
                                // get counties starts the init chain of events to populate dropdownlists
                                getCounties();
                        }

This is the code that puts the query results on the graphics layer:
Code:

                        // handle normal response from the server
                        private function onDoQueryResult(featureSet:FeatureSet, token:Object = null):void
                        {
                                // check for no records returned
                                if (featureSet.features.length == 0){
                                        // tell the user no records matched the query
                                        Alert.show("No records matched the query.");
                                }
                               
                                // set the extent of the map to the extent of the graphics
                                var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(featureSet.features);
                                if (graphicsExtent)
                                {
                                        map.extent = graphicsExtent;
                                }
                               
                                // assign a popup to each graphic
                                for each (var graphic:Graphic in featureSet.features)
                                {
                                        var infoWindowRenderer:ClassFactory = new ClassFactory(PopUpRenderer);
                                        infoWindowRenderer.properties = {popUpInfo: configurePopUpInfo()};
                                        graphic.infoWindowRenderer = infoWindowRenderer;
                                }
                               
                                // make sure the graphics layer is visible
                                graphicsLayer.visible = true;
                               
                                // set the graphic content to the query results
                                graphicsLayer.graphicProvider = featureSet.features;
                               
                                // query is complete so enable the controls
                                enableControls();
                        }

For reference this is configurePopUpInfo():
Code:

                        // configure the popup for a graphic
                        private function configurePopUpInfo():PopUpInfo
                        {
                                var popupFields:Array = [];
                                var popUpInfo:PopUpInfo = new PopUpInfo();
                               
                                popUpInfo.title = "{" + popuptitle + "}";
                               
                                for each (var field:Object in popupfields){
                                        var popupFieldInfo:PopUpFieldInfo = new PopUpFieldInfo();
                                        popupFieldInfo.fieldName = field.name;
                                        popupFieldInfo.label = field.alias;
                                        popupFieldInfo.visible = true;
                                        popupFields.push(popupFieldInfo);
                                }
                               
                                popUpInfo.popUpFieldInfos = popupFields;
                               
                                return popUpInfo;
                        }

Any input or guidance would be greatly appreciated.

Thanks,
Aaron

Viewing all articles
Browse latest Browse all 2097

Trending Articles