Clone a Server-based FeatureLayer to a local one?

1374
11
10-08-2010 06:34 AM
CharlieRichman
New Contributor
I'd like to populate a new local FeatureLayer (via its featureCollection) to match the features in a server-based FeatureLayer.  Any suggestions on a clean way do that? 

Clearly you can't grab the featureCollection from the source layer -- it's null.  Am I better off running a query against the source layer, or grabbing its graphicsProvider info?  (And how do you create a query that returns all records, anyway?)

Ideally I'd preserver symbology as well...

Thanks, folks.

Charlie Richman
DC Office of Planning
Tags (2)
0 Kudos
11 Replies
CharlieRichman
New Contributor
Sorry -- that's what I meant to type.

Thanks so very much for all of your help!

Charlie Richman
DC Office of Planning
0 Kudos
CharlieRichman
New Contributor
Interesting results with the search by extent.  The selection works, but is slow (3 seconds in my case.)  I assume that's because it's being handled by the browser.  Any tips for optimizing that?  Is this largely a function of polygon count?  Vertex count?  It might be faster for me to query a server-based geometry first and then grab the matching local geography manually.

Using code derived from the AttributeInspectorOutsideMap example, the Attribute Inspector window shows me empty space with my locally-instantiated featurelayer instead of the fields that I get with a server-based featurelayer.  (With a server-based layer I see all fields in default order automatically.)

<esri:AttributeInspector id="attributeInspector"
    left="6" right="6" top="6" bottom="6"
    featureLayers="{[blocks]}"
    formItemsOrder="fieldInspector"
    showFeature="attributesinspector_showFeatureHandler(event)"
    deleteButtonVisible="false">
</esri:AttributeInspector>


  private function attributesinspector_showFeatureHandler(event:AttributeInspectorEvent):void
            {
                highlightGraphicsLayer.clear();
                var g:Graphic = new Graphic(event.feature.geometry);
                g.toolTip = event.feature.toolTip;
                highlightGraphicsLayer.add(g);
            }

In the map:

<esri:FeatureLayer id="blocks">
   <esri:renderer>
   ... 
   </esri:renderer>
</esri:FeatureLayer>

Is there more that I need to specify to get the attributeInspector to work with my local featurelayer?


Charlie Richman
DC Office of Planning
0 Kudos