AnsweredAssumed Answered

Add watermark

Question asked by amarsden on Nov 14, 2014
Latest reply on Nov 14, 2014 by amarsden

Hi

 

I have used code derived from

 

http://warblingdiode.blogspot.co.uk/2010/02/watermarking-your-maps-with-esri-arcgis.html#comment-form

 

Before quite well.

 

I have now created a new site, and am being good, using AMD and stuff.  Yet it fails

 

This is the code I use, all in the function thingy of the initial require.

 

 

    dojo.declare("myScripts.WatermarkLayer", DynamicMapServiceLayer, {
        startExtent: new Extent({ xmin: 0, ymin: 0, xmax: 700000, ymax: 1300000, spatialReference: { wkid: 27700 } }),
        //construct the layer
        constructor: function (args) {
            this.initialExtent = this.fullExtent = this.startExtent;
            this.spatialReference = this.initialExtent.spatialReference;
            dojo.mixin(this, args);
            //set layer loaded property and fire onLoad event
            this.loaded = true;
            this.onLoad(this);
        },
        getImageUrl: function (extent, width, height, callback) {
            try {
                callback(this.url);
            }
            catch (ex) {
                console.debug("Error getting Watermark image. " + ex.message);
            }
        },
        _errorCallback: function (err) {
            console.error(err.message);
        }
    });
    wm = new myScripts.WatermarkLayer({ watermarkUrl: "Logo.png" })
    wm.setOpacity(1);
    map.addLayer(wm);  
    console.debug(wm)
    console.debug(map)

 

 

It doesn't error - the console of the wm object shows what I would expect.

 

The console of the map object shows the lyaer added.

 

yet I get

 

GET http://dev/test/null 404 (Not Found)

 

Error - and I get this every time I zoom in or out, which indicates it isn't finding the watermark image

 

It's late on a Friday - if anyone thinks they can help I can put all code live somewhere next week

 

ACM

Outcomes