Esri / workflowmanager-viewer-js

Source code for ArcGIS Workflow Manager Classic JavaScript viewer - Manage your workflows on the web.
Apache License 2.0
26 stars 31 forks source link

Support for FeatureLayers #8

Open vincentmajatladi opened 6 years ago

vincentmajatladi commented 6 years ago

Please add functionality to add feature layers to show features on top of the basemap.

Here is an example of what i did.

In AppConfig.js i added...

                {
                    url: "https://myserver/server/rest/services/layers/MapServer",
                    options: {
                        id: "mapLayer1",
                        imageParameters: {
                             layerIds: [1, 2, 3],
                             layerOption: "show"
                        },
                        opacity: 0.8,
                        showAttribution: false
                    }
                }
            ]

Then in EsriMap.js i added this...

           if (this.mapConfig.customLayers) {
                var customLayers = this.mapConfig.customLayers;
                for (var i = 0; i < customLayers.length; i++) {
                    var customLayer = customLayers[i];
                    var layer;
                    if (customLayer.options && customLayer.options.imageParameters) {
                        var params = new esri.layers.ImageParameters();
                        var keys = Object.keys(customLayer.options.imageParameters);
                        arrayUtil.forEach(keys, function (key) {
                            params[key] = customLayer.options.imageParameters[key];
                        });
                        customLayer.options.imageParameters = params;
                    }
                    layer = new esri.layers.ArcGISDynamicMapServiceLayer(customLayer.url, customLayer.options);
                    if (layer) {
                        this.map.addLayer(layer);
                    }
                }
            }