rvaitkus23

Map graphics problems

Discussion created by rvaitkus23 on Nov 18, 2010
Latest reply on Dec 16, 2010 by hzhu
Hi.

I am want to create a form for route printing. With maps for each route direction.
I have wrote a functio to create a simple map for html node with layers I need and extent, but I have one problem - map graphics is not displayed on map, despite map.graphics object has all graphic it needs (with geometry and symbols). Can someone help me? Here is my code:

function createMap(srcNodeRef, pExtent, pLayers){
    // CREATE MAP
    var map = new esri.Map(srcNodeRef, {
        extent: pExtent,
  logo : false,
        slider: false
    });
 dojo.connect(map, "onLoad", addGraphicsPrint);
 try {
  for (var i=0; i<pLayers.length - 1; i++) {
   map.addLayer(pLayers[i]);
  };
 } catch (e) {
  alert(e.message);
 }
 map.graphics.refresh();
 return map;
}

function addGraphicsPrint(map) {
    try {
  for(var i = 0, il = route.features.length; i<il; i++) {
   var feat = route.features[i];
   feat.setSymbol(routeSymbol);
   map.graphics.add(feat);
  }
    } 
    catch (e) {
     alert(e.message);
    }
} 

Outcomes