Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have two map services , one is tiled service returns a satellite image , and the other is dynamic displays the roads ,POIs and Parcels.

I'm trying to make the dynamic one shows the roads only above the satellite image , but i'm always getting white background with the roads and it covers the satellite image.

Here's my code :

map = new esri.Map("mapDiv");
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://URL_TO_SATELLITE/MapServer");
map.addLayer(basemap);

var imageParameters = new esri.layers.ImageParameters();
imageParameters.format = "png24";
imageParameters.height=100;
imageParameters.width=100;  
imageParameters.layerIds=[7]; // Only Roads !
imageParameters.layerOption = esri.layers.ImageParameters.LAYER_OPTION_SHOW;
imageParameters.transparent=true;   

var entrmap = new esri.layers.ArcGISDynamicMapServiceLayer("http://URL_TO_DYNAMIC/MapServer",
              {"imageParameters":imageParameters}); 

map.addLayer(entrmap);

Thank you for your help :)

share|improve this question
    
can you share some json data from ArcGISDynamicMapServiceLayer("URL_TO_DYNAMIC/MapServer") Query(supported operations) in ArcGIS Services for getting some information about data.. –  Aragon May 24 '12 at 13:42

3 Answers 3

If you set transparency only on one layer in your ArcMap file you should save it as MSD () and NOT mxd and in javascript init ArcGISDynamicMapServiceLayer with

imageParameters.format = "png32";

Here are some links to similair posts on ESRI forum:

http://forums.arcgis.com/threads/27413-layer-transparency-not-working

http://forums.arcgis.com/threads/10011-dynamic-layer-transparency

share|improve this answer
    
PNG24 delivers the transparency ... no need for PNG32 –  Mathboy May 27 '12 at 5:20
    
PNG24 as it name states consists of 3 colors, each 8 bytes size. I've read somewhere that Photoshop bring this misconception, because when you save image in PS in 'png24' it saves it in 'png32'. But I might be wrong, please check it out. –  ljader May 29 '12 at 9:02

I think this is a setting in the mxd in arcmap I will look and see what I can find, but I think it's in the document properties.

share|improve this answer
    
I don't need to have it as a transparent all the time , just in case of Aerial image , i want to make the background transparent . –  Mathboy May 27 '12 at 5:23
    
@Mathboy is there a reason not to make it transparent all the time? There is no penalty really. –  Steve May 29 '12 at 23:20

You should use the SetVisibleLayers method on the ArcGISDynamicMapServiceLayer, to set only one layer as visible.

This Would be the Code:

map = new esri.Map("mapDiv");
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://URL_TO_SATELLITE/MapServer");
map.addLayer(basemap);

var imageParameters = new esri.layers.ImageParameters();
imageParameters.format = "png24";

var entrmap = new esri.layers.ArcGISDynamicMapServiceLayer("http://URL_TO_DYNAMIC/MapServer",
              {"imageParameters":imageParameters}); 

              var visible = [7]; // Only Roads !
              entrmap.setVisibleLayers(visible); //<---------This is how you set it

map.addLayer(entrmap);
share|improve this answer
    
You have multiple ways to on/off the layers , one of them like what i wrote , and also one of them yours ! but still no transparency ! –  Mathboy May 27 '12 at 5:21
    
@Mathboy: esri.layers.ImageParameters is used in the way that you have only when calling ArcGISDynamicMapServiceLayer.exportMapImage, Geoprocessor.getResultImage, and Geoprocessor.getResultImageLayer. If you still do not get a transparent image, something is wrong with your ArcGIS server. Have you tried exporting an image manually from the REST end point? Have you tired consuming the Map service in ArcMap, and switching the layers off and on? –  Devdatta Tengshe May 28 '12 at 15:04
    
Yes i tried to open the layers via ArcMap , and everything went perfect , so i'm sure there's something should be in the code to activate the transparency –  Mathboy Jun 3 '12 at 6:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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