The best way to do this would be to set the FeatureLayer's selection symbol then call the selectFeatures() method.
Brian,You could always put a graphic on top of that feature?See this example.Hope this helps!Tim
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/> <title>CSS</title> <link rel="stylesheet" type="text/css" href="https://community.esri.com//js.arcgis.com/3.8/js/esri/css/esri.css"> <style> html, body, #map { height: 100%; margin: 0; } #legend { position: absolute; right: 0; top: 0; width: 120px; background-color: #fff; padding: 5px; margin: 10px; border-radius: 5px; } path[data-name="Washington"] { stroke: rgb(54, 93, 141); stroke-width: 1pt; stroke-opacity: 1; fill: rgb(54, 93, 141); fill-opacity: 0.7; } path[data-name="Jefferson"] { stroke: rgb(160, 63, 60); stroke-width: 1pt; stroke-opacity: 1; fill: rgb(160, 63, 60); fill-opacity: 0.7; } path[data-name="Franklin"] { stroke: rgb(115, 140, 61); stroke-width: 1pt; stroke-opacity: 1; fill: rgb(115, 140, 61); fill-opacity: 0.7; } path:not([data-name="Washington"]):not([data-name="Jefferson"]):not([data-name="Franklin"]) { stroke: rgb(0, 0, 0); stroke-width: 0.4pt; stroke-opacity: 0.5; fill: rgb(255, 255, 255); fill-opacity: 0; } </style> <script src="//js.arcgis.com/3.8/"></script> <script> require(["esri/map", "esri/layers/FeatureLayer", "dojo/domReady!"], function(Map, FeatureLayer) { var map = new Map("map", { basemap: "oceans", center: [-98.5795,39.828175], zoom: 5 }); var layer = new FeatureLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/3", { styling: false, dataAttributes: [ "name" ] }); map.addLayer(layer); }); </script> </head> <body> <div id="map"></div> <div id="legend"> <div align="center"><b>Most Common County Names in the US</b></div> <hr> <div> <svg width="12" height="12" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path data-name="Washington" d="M 1 1 L 11 1 L 11 11 L 1 11 Z" /> </svg> <span>Washington (31)</span> </div> <div> <svg width="12" height="12" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path data-name="Jefferson" d="M 1 1 L 11 1 L 11 11 L 1 11 Z" /> </svg> <span>Jefferson (27)</span> </div> <div> <svg width="12" height="12" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path data-name="Franklin" d="M 1 1 L 11 1 L 11 11 L 1 11 Z" /> </svg> <span>Franklin (25)</span> </div> <div> <svg width="12" height="12" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path data-name="Other" d="M 1 1 L 11 1 L 11 11 L 1 11 Z" /> </svg> <span>Other</span> </div> </div> </body> </html>
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.