AnsweredAssumed Answered

TextSymbol Location

Question asked by commtax on Feb 4, 2016
Latest reply on Feb 8, 2016 by rscheitlin

Please forgive me for what is probably a totally newbie question, but the programmer who started this project left and I am really under the gun. I have looked at every sample I could find, and have searched the forum to no avail.

We are able to pull up all of the properties within a (user-defined) radius of the center of our subject property.

What I need to do is to place  text near the center of each of the properties that fall within the radius. (HCAD_NUM, Site Address, etc. from the ShapeFile)

I see how to get the extents for the map, but how to  determine the location and size of the individual plots escapes me.

I would also like to determine the width of the individual plots so I can adjust the fonts size and, perhaps text rotation so the text doesn't leak over onto other properties. (Desired Text is shown in red)

My failed attempt to add text is at the very bottom.






  function (Map, ArcGISDynamicMapServiceLayer, QueryTask,
  Query, dom, on, FeatureLayer, Color, SimpleLineSymbol, SimpleFillSymbol, SimpleRenderer, Extent, parser, Circle, Units, Font, TextSymbol)


    //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;
        //new Circle(center, options?)
        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([180, 180, 180, 1])
      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 featureAttributes = graphic.attributes;
          var resultItems = [];
          for (var attr in featureAttributes) {
              resultItems.push("<b>" + attr + ":</b>  " + featureAttributes[attr] + "<br>");


          var textSymbol = new TextSymbol(featureAttributes[attr]);



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