Skip to content

Error behaviour with floating-point tilePoints #2288

@dagjomar

Description

@dagjomar

Similar to #1886

After upgrading to 0.7 stable, I could no longer load the WMS tileLayer, because the script stopped after throwing "Uncaught Error: No value provided for variable {s} ".

After debugging, I found that this occured when trying to find the subdomain array item using an illegal index value. This was caused by the fact that the function
var index = Math.abs(tilePoint.x + tilePoint.y) % this.options.subdomains.length;
returned a non-integer because tilePoint.x was a float (6.00000000002)

How this tilePoint.x became 6.00000002 is beyond me, but a simple fix was to use ´´´Math.round```in the expression to prevent this behaviour.

final fix:
var index = Math.round(Math.abs(tilePoint.x + tilePoint.y)) % this.options.subdomains.length;

screen shot 2013-12-12 at 13 52 20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions