[GeoNode-users] Custom background layers not in Thumbnail

John, Steffen s.john at atenekom.eu
Thu Mar 16 01:43:35 PDT 2017


Hi,
I created custom map base layers, which are added to every newly
created map. When saving this map, the thumbnail is created without the
basemap on it.

To define the basemaps, i added a gxp plugin, correspondingly to the
BingSource, based on a WMS. May be I missed something? 
Do you have any idea, what I have done wrong?

Thank you so much for your help.

Here is the code:

gxp.plugins.WebAtlasFarbeSource = Ext.extend(gxp.plugins.LayerSource, {

    ptype: "gxp_webatlasfarbesource",

    title: "WebAtlasDE Farbe",
    
    webAtlasFarbeTitle: "WebAtlasDEFarbe",
    url: "https://sg.geodatenzentrum.de/wms_webatlasde__UUID",
    attribution: "© GeoBasis-DE / <b>BKG</b> ("+year+")",
    createStore: function() {
        
        var layers = [
             new OpenLayers.Layer.WMS(this.webAtlasFarbeTitle,
                                   this.url,
                                   {layers: ["webatlasde"],
                                   format:"image/png",
                                   tiled: true
                                   },
                                   {
                                       attribution : this.attribution
                                   })

        ];
        
        this.store = new GeoExt.data.LayerStore({
            layers: layers,
            fields: [
                {name: "source", type: "string"},
                {name: "name", type: "string", defaultValue:
"webatlasdefarbe"},
                {name: "abstract", type: "string", mapping:
"attribution"},
                {name: "group", type: "string", defaultValue:
"background"},
                {name: "fixed", type: "boolean", defaultValue: true},
                {name: "selected", type: "boolean"}
            ]
        });
        this.store.each(function(l) {
            l.set("group", "background");
        });
        this.fireEvent("ready", this);

    },
    
    createLayerRecord: function(config) {
        var record;
        var index = this.store.findExact("name", config.name);
        if (index > -1) {

            record =
this.store.getAt(index).copy(Ext.data.Record.id({}));
            var layer = record.getLayer().clone();
 
            // set layer title from config
            if (config.title) {
                /**
                 * Because the layer title data is duplicated, we have
                 * to set it in both places.  After records have been
                 * added to the store, the store handles this
                 * synchronization.
                 */
                layer.setName(config.title);
                record.set("title", config.title);
            }

            // set visibility from config
            if ("visibility" in config) {
                layer.visibility = config.visibility;
            }
            
            record.set("selected", config.selected || false);
            record.set("source", config.source);
            record.set("name", config.name);
            if ("group" in config) {
                record.set("group", config.group);
            }

            record.data.layer = layer;
            record.commit();
        }
        return record;
    }

});

Ext.preg(gxp.plugins.WebAtlasFarbeSource.prototype.ptype,
gxp.plugins.WebAtlasFarbeSource);




More information about the geonode-users mailing list