Wish to add MapImageLayers to WAB application through LocalLayerWidget

2612
1
Jump to solution
07-20-2015 11:27 PM
HumzaAkhtar
Occasional Contributor II

Can anyone give me some pointers on how to go about doing this ?   There will be some changes to be done in the LocalLayerWidget code I believe.

0 Kudos
1 Solution

Accepted Solutions
HumzaAkhtar
Occasional Contributor II

Figured it out,,

Add the json of the layer to config_Local Layer Widget.json :

   {

       "type": "Mapimage",

        "name": "Animation Layer",

        "href": "http://www.aoaophoto.com/video-to-gif-converter/imgs/sample-iceage4.gif",

        "extent": { "xmin": -79.933333, "ymin": 32.783333, "xmax": -80.933333, "ymax": 33.783333, "spatialReference":{"wkid":4326}},

        "opacity": 1,

        "visible": false

      },

Then Add the following code to the Widget.js file  (in the startup function)

if(layer.type.toUpperCase() === 'MAPIMAGE'){

            var mil = new MapImage({

            'extent': layer.extent,

            'href': layer.href

            });

            lOptions.extent = layer.extent;

            lLayer =new MapImageLayer(lOptions);

            lLayer.addImage(mil);

            lLayer.on("load", function() {

             evt.layer.name = lOptions.id;

            });

            this._viewerMap.addLayer(lLayer);

           

          },

View solution in original post

1 Reply
HumzaAkhtar
Occasional Contributor II

Figured it out,,

Add the json of the layer to config_Local Layer Widget.json :

   {

       "type": "Mapimage",

        "name": "Animation Layer",

        "href": "http://www.aoaophoto.com/video-to-gif-converter/imgs/sample-iceage4.gif",

        "extent": { "xmin": -79.933333, "ymin": 32.783333, "xmax": -80.933333, "ymax": 33.783333, "spatialReference":{"wkid":4326}},

        "opacity": 1,

        "visible": false

      },

Then Add the following code to the Widget.js file  (in the startup function)

if(layer.type.toUpperCase() === 'MAPIMAGE'){

            var mil = new MapImage({

            'extent': layer.extent,

            'href': layer.href

            });

            lOptions.extent = layer.extent;

            lLayer =new MapImageLayer(lOptions);

            lLayer.addImage(mil);

            lLayer.on("load", function() {

             evt.layer.name = lOptions.id;

            });

            this._viewerMap.addLayer(lLayer);

           

          },