layers changing colors

1094
2
Jump to solution
12-12-2016 09:22 AM
PaulYoum1
New Contributor II

I'm using a map service that has simple green and gold lines. I don't want to expose the map service to the world, but I can provide an example of what the map service looks like through the AGO map viewer:

But as soon as I put this in a "custom" javascript page using ArcGISDynamicMapServiceLayer, the colors on the layers become muted:

Attached below is my source code consuming the dynamic map service:

<!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></title>
   

    <link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css">
    <script src="https://js.arcgis.com/3.18/"></script>

    <script>

        var map;
        require(["esri/map",
                    "esri/layers/ArcGISDynamicMapServiceLayer",
                    
                    "dojo/domReady!"], function(Map, ArcGISDynamicMapServiceLayer) {
          map = new Map("map", {
            basemap: "topo",
            center: [-122.3321, 47.606],
            zoom: 13
          });

          var testLayer = new ArcGISDynamicMapServiceLayer("My Map Service Layer");

          map.addLayer(testLayer);          
        });
    </script>


<style>
  html, body, #map {
    height: 100%;
    padding: 0;
    margin: 0;
  }
</style>

  </head>

<body class="claro">
  <div id="map"></div>
</body>


</html>

It's a basic setup but for some reason the layer is coming across with muted colors. Any help or suggestions would be appreciated!

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Paul,

   Does the MXD that the map service comes from have some opacity applied to that layer? The difference in using a ArcGISDynamicMapServiceLayer vs. a FeatureLayer is that the ArcGISDynamicMapServiceLayer is drawn on the server using the symbology applied to layer in the mxd where as the FeatureLayer draws the layer client side.

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Paul,

   Does the MXD that the map service comes from have some opacity applied to that layer? The difference in using a ArcGISDynamicMapServiceLayer vs. a FeatureLayer is that the ArcGISDynamicMapServiceLayer is drawn on the server using the symbology applied to layer in the mxd where as the FeatureLayer draws the layer client side.

PaulYoum1
New Contributor II

Thanks Robert! That was exactly it. I went back to the source MXD and saw that there was an opacity set on the layer. I didn't realize the differences in how the layer is drawn from the DynamicMapServiceLayer vs FeatureLayer. Thanks for the  help!

0 Kudos