AnsweredAssumed Answered

TextSymbol Bombs

Question asked by commtax on Jan 29, 2016
Latest reply on Jan 29, 2016 by commtax


Sadly the developer who started this project has quit, and I am desperately trying to get up to speed.

All I want is something simple. Should be one of the most common functions in mapping - to add text inside a graphic as shown. (The map is generated, i put the number in there using paint for purposes of this post)

But as soon as I define a textsymbol, the program bombs. I don't even have to do anything with it, just the var declaration kills it. (See near the bottom of the code)

I have "required"  esri/symbols/TextSymbol among others at the top of the script file.

The idea is to place the contents of the HCAD_NUM field from the shapefile near the middle of each plot. But I can't even get it to show a hard-coded "Hello world" anywhere on the screen.

Any help would be greatly appreciated.
































  function (Map, ArcGISDynamicMapServiceLayer, QueryTask,

  Query, dom, on, FeatureLayer, Color, SimpleLineSymbol, SimpleFillSymbol, SimpleRenderer, Extent, parser, Circle, Units)





    //map = new Map("map");



    map = new Map("map", {

        //extent: bbox,

        showLabels: true //very important that this must be set to true!  



    var baseLayer = new ArcGISDynamicMapServiceLayer("");



    var countyLayer = new FeatureLayer("");

    var outline = new SimpleLineSymbol("solid", new Color([255, 255, 255, 1]), 2);

    var fill = new SimpleFillSymbol("solid", outline, new Color([255, 255, 0, 0.5]));

    countyLayer.setRenderer(new SimpleRenderer(fill));




     //Query the parcels layer for the subject property

    queryTask = new QueryTask("");

    query = new Query();

    query.returnGeometry = true;

    query.outFields = ["HCAD_NUM", "LocAddr"];



    //Set up a callback for when the get details button is pressed.

    function execute()


      query.where = "HCAD_NUM = '" + dom.byId("hcad_num").value + "'";

      queryTask.execute(query, foundSubject);


    on(dom.byId("execute"), "click", execute);


    //Set up a query for

    function foundSubject(results)


        var f = results.features;

        circle = new Circle({center: f[0].geometry.getExtent().getCenter(), radius: dom.byId("distance").value, radiusUnit: Units.FEET});


        //Execute a new query that searches for all properties around subject

        var areaQuery = new Query();

        areaQuery.geometry = circle.getExtent();

        areaQuery.returnGeometry = true;

        areaQuery.outFields = ["HCAD_NUM", "LocAddr"];

        queryTask.execute(areaQuery, showResults);




    function showResults(results)


      var symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,

      new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,

      new Color([0, 0, 0]), 1.0), new Color([255, 255, 255, 1])



      var textSymbol = new TextSymbol("Hello, World");

      var resultFeatures = results.features;;

      var resultFeatures = results.features;


        //Zoom to parcel

      var ex = esri.graphicsExtent(resultFeatures);



      for (var i = 0, il = resultFeatures.length; i < il; i++) {

          var graphic = resultFeatures[i];




          var point =;


          var featureAttributes = graphic.attributes;

          var resultItems = [];

          for (var attr in featureAttributes) {

              resultItems.push("<b>" + attr + ":</b>  " + featureAttributes[attr] + "<br>");






      dom.byId("info").innerHTML = resultItems.join("");