0

I am a web programmer with no GIS experience and I am working with a GIS specialist with no web service experience. I am using the JavaScript API 3.7 but I am not very familiar with the API.

I have a select list containing unique identifiers for line segments within a layer. I can currently zoom to the location of the segment on change of the select but I would also like to highlight the selected segment on the map. I have set up a executeIdentifyTask on click of the map. I am not sure if I should call the click method and pass it the coordinates of the segment or if there is a different identify method that I should be using instead.

Chris W
  • 15,720
  • 2
  • 29
  • 47
  • I think this Q/A may help in what you are trying to do, http://gis.stackexchange.com/questions/17215/is-there-a-select-by-attributes-plugin-widget-for-arcgis-server-js-api – artwork21 Dec 10 '13 at 02:26

1 Answers1

1

You need to create a graphic. If you are already zooming to the feature you should have the feature's geometry. A basic graphic consists of a geometry and a symbol but can also include attributes and an infoTemplate. It might look like the following:

require (['esri/graphic','dojo/_base/Color'], function addGraphic(geometry)
{
    //assuming your 'segments' are polylines
    var graphic;

    if(geometry.type === 'polyline')
    {
        require(['esri/symbols/SimpleLineSymbol'],function()
        {
            var sls= new SimpleLineSymbol('STYLE_SOLID', new Color([255,0,0]), 2);
            graphic = new Graphic(geometry, sls);
        });
    }

    map.graphics.add(graphic);

});
gmack
  • 11
  • 1