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

1945
3
Jump to solution
10-09-2013 07:42 AM
SteveCole
Frequent Contributor
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
0 Kudos
1 Solution

Accepted Solutions
BenFousek
Occasional Contributor III
0 Kudos
3 Replies
BenFousek
Occasional Contributor III
0 Kudos
SteveCole
Frequent Contributor
Awesomesauce. That did it. Thanks, Ben!
0 Kudos
BenFousek
Occasional Contributor III
Happens to the best of us.

Rock on!
0 Kudos