AnsweredAssumed Answered

Dim basemap

Question asked by scott@er on Jan 21, 2020
Latest reply on Jan 21, 2020 by rscheitlin

Hi, i'm following this example to map the boundary of my authority.  In my code below, i highlight the counties with a red border and dim the layer.  I would like to reverse the dim effect, instead, i would like the basemap to be dimmed and the feature layer not dimmed.

 

How can i achieve this effect?

 

I have followed this example, which dims the basemap, but it also dims my feature layer.  I don't want my feature layer to be dimmed, just everything that surrounds it.

Help setting opacity/transparency of Basemap 

 

thanks

 

Feature layer hover | ArcGIS API for JavaScript 3.31 

 

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Feature Layer - display results as an InfoWindow onHover</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.31/dijit/themes/tundra/tundra.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.31/esri/css/esri.css">
<style>
html, body, #mapDiv {
padding:0;
margin:0;
height:100%;
}
#mapDiv {
position: relative;
}
</style>
<script src="https://js.arcgis.com/3.31/"></script>
<script>
var map, dialog;
require([
"esri/map", "esri/layers/FeatureLayer",
"esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol",
"esri/renderers/SimpleRenderer", "esri/graphic", "esri/lang",
"esri/Color", "dojo/number", "dojo/dom-style",
"dijit/TooltipDialog", "dijit/popup", "dojo/domReady!"
], function(
Map, FeatureLayer,
SimpleFillSymbol, SimpleLineSymbol,
SimpleRenderer, Graphic, esriLang,
Color, number, domStyle,
TooltipDialog, dijitPopup
) {
map = new Map("mapDiv", {
basemap: "topo",
center: [-80.94, 33.646],
zoom: 8,
slider: false
});
var southCarolinaCounties = new FeatureLayer("https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3", {
mode: FeatureLayer.MODE_SNAPSHOT,
outFields: ["NAME", "POP2000", "POP2007", "POP00_SQMI", "POP07_SQMI"]
});
southCarolinaCounties.setDefinitionExpression("STATE_NAME = 'South Carolina'");
var symbol = new SimpleFillSymbol(
SimpleFillSymbol.STYLE_SOLID,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([255,0,0]), 2
),
new Color([125,125,125,0.25])
);

southCarolinaCounties.setRenderer(new SimpleRenderer(symbol));
map.addLayer(southCarolinaCounties);

map.on("load", function(){
map.graphics.enableMouseEvents();
});

});
</script>
</head>
<body class="tundra">
<div id="mapDiv">
</div>
</body>
</html>

Outcomes