spatialmax

FeatureLayer has no graphics collection unless I give it to the Map ...

Discussion created by spatialmax on Sep 9, 2012
Latest reply on Sep 10, 2012 by ptrollope-esri-southafrica-esridist
All,

I have the need to create a FeatureLayer (local or not) and gain access to its Features --without the use of a Map--.  I haven't been successful.  The following steps are what I assumed would work:

1.  Create a LocalFeatureService.
2.  Point it towards a valid MapPackage file.
3.  Start the Service.
4.  On StartCompleted -> Create a LocalFeatureLayer.
5.  Give the LocalFeatureLayer the 'Service' and a valid 'LayerName' (a corresponding, editable layer within the MapPackage).
6.  Initialize the Layer.
7.  OnInitialized -> Call ::Update() on the layer.
8.  Cast to GraphicsLayer.
9.  Get the Graphics Collection.

I assumed I would see all the Features within the Layer as graphics; I don't (its count = 0).

NOTE:  If the LocalFeatureLayer is created and given to a map it will have a valid Graphics Collection.

Does anyone see another way around this??

-Mike

Outcomes