Exand tree nodes to liveMapwidget

1849
11
04-19-2012 07:01 AM
RashaGarfinkel
New Contributor
I am trying to add the name of the features under each of the feature layer names - make the tree one level deeper & the features should be selected based on their map visibility - How do I get the features from the feature layer & add them as items to the tree?
0 Kudos
11 Replies
derekswingley1
Frequent Contributor
What is the "liveMapWidget"?
0 Kudos
RashaGarfinkel
New Contributor
What is the "liveMapWidget"?


It's one of the widgets that displays a tree like structure of layer name & feature layer name - basically I want to add the name of the visible idividual features under the feature layer name list
so far I loop through the layers & when I get a sublayer(featrue layer) I try doing the IdentifyTask to get the features but none come back?
0 Kudos
derekswingley1
Frequent Contributor
It's one of the widgets that displays a tree like structure of layer name & feature layer name - basically I want to add the name of the visible idividual features under the feature layer name list
so far I loop through the layers & when I get a sublayer(featrue layer) I try doing the IdentifyTask to get the features but none come back?


I should have been more specific...we don't have anything in the API called a "liveMapWidget". Where did the liveMapWidget come from? Who wrote it? You're best bet is to reach out to the developer of the widget.
0 Kudos
RashaGarfinkel
New Contributor
I should have been more specific...we don't have anything in the API called a "liveMapWidget". Where did the liveMapWidget come from? Who wrote it? You're best bet is to reach out to the developer of the widget.


I was using that widget thinking that it is known since I am new to this - its a UI tree that displays maplayers & feature layers based on their visibility on the map
so to rephrase my question if I have code to get the layers from the map:
for(var i = this.map.layerIds.length - 1; i >= 0; i--){
                                var layerId = this.map.layerIds;
                                var layer = this.map.getLayer(layerId);
}
how would I get the inidividual features of the given layer?
0 Kudos
derekswingley1
Frequent Contributor
I was using that widget thinking that it is known since I am new to this - its a UI tree that displays maplayers & feature layers based on their visibility on the map
so to rephrase my question if I have code to get the layers from the map:
for(var i = this.map.layerIds.length - 1; i >= 0; i--){
                                var layerId = this.map.layerIds;
                                var layer = this.map.getLayer(layerId);
}
how would I get the inidividual features of the given layer?


Check the layer's declaredClass property. If it's esri.layers.GraphicsLayer or esri.layers.FeatureLayer then you can access the layer's features via layer.graphics.
0 Kudos
RashaGarfinkel
New Contributor
Check the layer's declaredClass property. If it's esri.layers.GraphicsLayer or esri.layers.FeatureLayer then you can access the layer's features via layer.graphics.


Its saying that its a esri.layers.ArcGISDynamicMapServiceLayer - would you know how I can accesss its  features
0 Kudos
derekswingley1
Frequent Contributor
Its saying that its a esri.layers.ArcGISDynamicMapServiceLayer - would you know how I can accesss its  features


Dynamic map service layers consist of single image created on the fly as requested by a client. If you want info about features, you have to make a request to the server. The easiest way to do this is with a queryTask.
0 Kudos
JeffPace
MVP Alum
Are you using the JS Sample Viewer? It contains a livemapswidget

if so, the name (label) in the tree comes from the config.xml file


  <livemaps>
                    <mapservice label="Community Redevelopment Areas" type="dynamic" visible="false" alpha="0.6">http://www.mymanatee.org/arcgis/rest/services/community-services/cra/MapServer</mapservice>
0 Kudos
RashaGarfinkel
New Contributor
Dynamic map service layers consist of single image created on the fly as requested by a client. If you want info about features, you have to make a request to the server. The easiest way to do this is with a queryTask.


I had tried queryTask - I am not even getting into the call back - not sure what is wrong with my query - here it is:
getFeatures: function(){
var queryTask = new esri.tasks.QueryTask(sublayeritem.url);
                                        var queryP = new esri.tasks.Query();
                                        queryP.returnGeometry = true;
                                        queryP.outFields = ["*"];
                                        queryP.outSpatialReference = this.map.spatialReference;
                                        queryTask.execute(queryP, dojo.hitch(this, "resultCallback"));

},

resultCallback: function(featureSet) {
}
0 Kudos