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.
-
I think this Q/A may help in what you are trying to do, gis.stackexchange.com/questions/17215/…artwork21– artwork212013年12月10日 02:26:21 +00:00Commented Dec 10, 2013 at 2:26
1 Answer 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);
});
Explore related questions
See similar questions with these tags.