simon.miles.rbwm

remove defaultSymbol

Discussion created by simon.miles.rbwm on Nov 11, 2010
Latest reply on Nov 17, 2010 by gilest
probably very simple, but i cant work it out. I want to remove the defaultSymbol statement from the below JS, so that i can see the symbols as defind in my arcmap project. When i do remove the statement, i cant see the layer in my map. Any ideas.

Thanks

Si


dojo.require("esri.map");
      dojo.require("esri.tasks.query");

      //global variables
      var map, defaultSymbol, resultTemplate;

      function init() {
        var initExtent = new

esri.geometry.Extent({"xmin":467047.747001408,"ymin":164818.857300987,"xmax":519157.538720992,"ymax":187956.716076704,"spatialReference":{"wkid":27700}});
        map = new esri.Map("map",{extent:initExtent});

        //Add the world street map layer to the map. View the ArcGIS Online site for services http://arcgisonline/home/search.html?t=content&f=typekeywords:service   
       
   var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://****/ArcGIS/rest/services/basemapping_v2/MapServer");
        map.addLayer(basemap); 

        //initialize symbology
        defaultSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([0,0,255]));
       
        //initialize & execute query
        var queryTask = new esri.tasks.QueryTask("http://****/ArcGIS/rest/services/Live/****/MapServer/0");
        var query = new esri.tasks.Query();
        query.where = "DATE_ = 'November'";
        query.outSpatialReference = {wkid:27700};
        query.returnGeometry = true;
        query.outFields = ["*"];
        queryTask.execute(query, addPointsToMap);

        //info template for points returned
  resultTemplate = new esri.InfoTemplate("${NAME}",
      "<tr><td>${ROADNAME}</tr></td><br/>"
           + "<tr><td>${VILLAGE}</tr></td><br/>"
            + "<tr><td>${TOWN}</tr></td><br/>"
           + "<tr><td>${PC}</tr></td><br />"
           + "<tr><td>tel : ${TEL}</tr></td><br />"
           + "<tr><td>visit website : <a href=${WEB} target=_blank>click here</a></tr></td><br />"
           + "<tr><td>view ofstead report : <a href=${OFSTEAD} target=_blank>click here</a></tr></td><br />");
        




      }

      //add points to map and set their symbology + info template
      function addPointsToMap(featureSet) {
        var features = featureSet.features;
        for (var i=0, il=features.length; i<il; i++) {
          map.graphics.add(features[i].setSymbol(defaultSymbol).setInfoTemplate(resultTemplate));
        }
            }

      dojo.addOnLoad(init);

Outcomes