AnsweredAssumed Answered

One service- but seperate layers inside as seperate JS API layers?

Question asked by evtguy on Oct 9, 2013
Latest reply on Oct 9, 2013 by btfou
Ok, I suddenly feel stupid and can't figure this out..

In my web app, I have both census tracts and block groups available as layers that my users can turn on or off. The layers are added to my app as DynamicMapServiceLayers. Up until this point, I published the census tract and block group datasets as seperate services and that all works just fine.

I decided to change this recently and package both datasets into ONE service primarily because the auto generated labels within the service would overlay on top of each other and look crappy. I figured that if they were in the same MXD when published, the labeling mess wouldn't happen. I published them together and add them to my map like this:
 // Define the census tract map layer  theTractLayer = new esri.layers.ArcGISDynamicMapServiceLayer(SERVERPATH + "/demography/censusBoundaries/MapServer/0", {   visible: false  });     // Define the census block group layer  theBlockgroupLayer = new esri.layers.ArcGISDynamicMapServiceLayer(SERVERPATH + "/demography/censusBoundaries/MapServer/1", {   visible: false  });


After making this change, I now get a 400 Bad Request Error whenever I try to display either layer. Apparently the URL can't dive down into the service deeper than the "/MapServer" level.

So how can I accomplish my goal of bundling the two datasets as one service but add them to my map as separate layers as far as JS is concerned?

Thanks!
Steve

Outcomes