Zum Hauptinhalt gehen

AddMapService, Custom Module, layer visibility not working

Kommentare

2 Kommentare

  • Mike Ketler
    Hi,

     

    Unfortunately custom modules are not something the Support Team could help you with.

     

    If you still require help then it's possible you could work with our Implementation Services team. I'd recommend opening a support ticket so we can advise you of the requirements for engaging with the Implementation Services. 

     

    Thanks,

     

    Mike Ketler
    0
  • Tyson Schoepflin

    If anyone is still looking for a solution here is a method that worked.

     

     

    let url: string = "https://YOURADDRESSHERE/arcgis/rest/services/SOMEPATH/MapServer";

     

    let workingService: MapService = new MapService(url);

     

     

    let layerOptions = { "id": "dynamicLayerTestShouldBeAGUID", "opacity":1, "showAttribution": false };

     

    let dLayer = new esri.layers.ArcGISDynamicMapServiceLayer(url, layerOptions);

     

    dLayer.setVisibleLayers([7]); 

     

     

    The fix here is to use setVisibleLayers.  You can use a layer ID or a layer name as a string.

    dLayer.setVisibleLayers([7]); 

     

    dLayer.setVisibleLayers(["Some Layer Name"]); 

     

     

    Setup the MapService.

    workingService.serviceLayer = dLayer;                                

     

    workingService.mapServiceType = MapServiceType.DYNAMIC;

     

    workingService.isUserCreated = true;

     

    workingService.userLayerType = "LayerAddition";

     

    workingService.includeInLayerList = true;                       

     

    //workingService.essentialsMap = this.app.site.essentialsMap;                

     

    workingService.displayName = "Custom Layer";

     

    //newMapService.disableClientCaching = true;

     

    workingService.mapServiceFunction = MapServiceFunction.OPERATIONAL;

     

    workingService.opacity = 1;

    Finally, list for the layer to finish loading.  Make any final map service changes based on the loaded layer and then use the AddMapService command.

    dLayer.on("load", (args) => {

     

       workingService.id = dLayer.id;

     

       thisViewModel.app.commandRegistry.commands.AddMapService.execute(workingService);

     

    });
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.