[OpenLayers-Users] "P is undefined"-Error after builing a singleFile-edition

Eric Lemoine eric.lemoine at camptocamp.com
Sun Aug 28 05:20:58 EDT 2011


On Fri, Aug 26, 2011 at 1:40 PM, Marco Scheuble <mail at marco-scheuble.de> wrote:
> Hi all,
>
> I extended Openlayers with the Class = OpenLayers.Layer.Wetter4.
> As long as I'm using 'lib/OpenLayers.js' everything works fine.
> But if I take the builded singleFile 'OpenLayers.js' I get the error: "P is
> undefined".
>
> Anyone can give me a hint?
>
> Thanks in advance,
> Marco
>
> ---------------------------------------------
>
> OpenLayers.Layer.Wetter4 = OpenLayers.Class(OpenLayers.Layer.TMS, {
>
>        initialize: function(name, url, options) {
>            OpenLayers.Layer.TMS.prototype.initialize.apply(this, [name,
> url, options]);
>            this.singleTile = true;
>            this.ratio = 1;
>            this.options.setting = '&leg=nil&a=image';
>        },
>
>        getURL: function(bounds) {
>            var x1 = bounds.left;
>            var x2 = bounds.right;
>            var y1 = bounds.bottom;
>            var y2 = bounds.top;
>
>            var date = (this.options.dt != undefined) ? this.options.dt : '';
>            var q = this.options.query;
>            var setting = this.options.setting;
>            setting += '&x=' + this.tileSize.w + '&y=' + this.tileSize.h;
>            var src = this.url + 'q=' + q + setting + '&x1=' + x1 + '&x2=' + x2 +
> '&y1=' + y1 + '&y2=' + y2 + '&dt=' + date;
>
>            return src;
>        },
>
>        CLASS_NAME: 'OpenLayers.Layer.Wetter4'
>    });

You have to have Layer/TMS.js in the built OpenLayers.js script. And
you need to make sure the browser evaluates OpenLayers.js before your
own script.

Cheers,



-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Users mailing list