I've just updated to the latest dev version so my maps will work in IE, and while they are now working in IE8, IE7 displays this error and no map:

Message: Expected identifier, string or number

Line: 18

Char: 5

Code: 0

URI: http://www.ava.asn.au/sites/www.ava.asn.au/modules/ava_module/layer-hand...

The file in question is part of a custom module I wrote to add my own map layer. However, it works fine in IE8, so I'm hoping someone can help me fix it for IE7 too:

OL.Layers.TMS = function(layerOptions, mapid) {

  // Avoid pink tiles

  OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;

  OpenLayers.Util.onImageLoadErrorColor = "transparent";

  return new OpenLayers.Layer.TMS(
    "TMS Layer",
    "http://www.ava.asn.au/sites/www.ava.asn.au/files/floor_plan/",
    {
      maxExtent: new OpenLayers.Bounds(0.0, 0.0, 1508.0, 1524.0),
      numZoomLevels: 4,
      type: 'jpg',
      getURL: overlay_getTileURL,
    } // <-- This is the line referred to by the error...
  );
}

function overlay_getTileURL(bounds) {

  var res = this.map.getResolution();

  var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));

  var y = Math.round((bounds.bottom - this.maxExtent.bottom) / (res * this.tileSize.h));

  var z = this.map.getZoom();
  if (x >= 0 && y >= 0) {

    return this.url + z + "/" + x + "/" + y + "." + this.type;

  } else {

    return "http://www.maptiler.org/img/none.png";

  }

}

Comments

tmcw’s picture

Status: Active » Fixed

Remove the comma before the }.

BWPanda’s picture

Wow, I didn't realise IE7 could be so pedantic...
Thanks, works perfectly now!

tmcw’s picture

Oh, IE will surprise you. Always in bad ways.

BWPanda’s picture

:)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.