VinayBa

feature layer  approach

Discussion created by VinayBa on Nov 26, 2013
HI All,

    WE have developed an application using ArcGIS js api whichs world, well I know most of the time ArcGIS is useful  for real
time data and spatial analysis but in our application we need map mostly for user interactivity .Users of our applications mostly click on map and that region of map gets highlighted or else we highlight the map on load and user  clicks on the highlighted country and see pop-up.Please let me know if my approach is fine.
      I am using feature layer with MODE_SNAPSHOT mode , now whenever I want to highlight the country in the map or when user clicks on the map the call goes to server ( which is not required from performance point of view).

    For highlighting I used :QueryTask where I passed the country name and to the graphics returned I added setSymbol and added the graphics using  map.graghics.add().

for user click I used featureLayer.selectFeature .

To improve performance I used following since in SNAPSHOT mode all graphics are preloaded.

Since query task hits server I used
dojo.forEach(featureLayer.graphics,function(graph){
if(graph.attribute.CNTRY_NAME=='India'){
graph.setSymbol(somesymbol);
map.graghics.add(graph);
}
});


On load of page I highlight some countries based on some criteria.

now I  have toggle button where user clicks a button all the graphics gets cleared and user can click on country to highlight it.
sometimes after user clicks on   country all previously highlighted countries or graphics are highlighted again this is strange behavior
what could be the reason and is my approach fine.

Outcomes