AnsweredAssumed Answered

LabelPoints with text from queryTask

Question asked by Schnoerkel on Aug 16, 2012
Latest reply on Oct 23, 2012 by Schnoerkel
I like to lable all geometrys in a query with the name of the owner. The point where the TextSymbol is generatet by the geometryService.labelPoints function. I got an X and Y Koordinate but how i get the Name of the owner in the text symbol?

My Code:
function name_eintragen(ind) {    map.graphics.clear();    //build query task    queryTask = new esri.tasks.QueryTask("http://geoarcgis-srv/dienste/rest/services/alkis/FeatureServer/42");    query = new esri.tasks.Query();    query.returnGeometry = true;    query.outFields = ["id,ownername"];     query.where = "id IN('" + ind + "')";     queryTask.execute(query,function(fset)   {    dojo.forEach(fset.features, function (feature)    {       if(feature.geometry.rings.length > 0)    {              i = feature.geometry.rings.length;     geometryService.simplify([ feature.geometry ],function (geometries,i)      {            if(geometries[0].rings.length > 0)                                         {       geometryService.labelPoints(geometries, function(labelPoints)                                                  {             var font = new esri.symbol.Font("20px",                                                    esri.symbol.Font.STYLE_NORMAL,                                                    esri.symbol.Font.VARIANT_NORMAL,                                                    esri.symbol.Font.WEIGHT_BOLDER);         dojo.forEach(labelPoints, function(labelPoint)                                                   {            var textSymbol = new esri.symbol.TextSymbol('%ownername%', font, new dojo.Color([0, 0, 0]));                       var labelPointGraphic = new esri.Graphic(labelPoint,textSymbol);           // add the label point graphic to the map        map.graphics.add(labelPointGraphic);        globalcounter++;         });       });      }         });    }   });      }); }


The '%ownername%' marks where the name of the owner should stand.

any suggestions?

Outcomes