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.

1

1 Answer 1

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);

});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.