since #1159328: TMS baselayer functionality we have the baselayer switcher available when defining TMS layers. this enables to define a layer as either baselayer or overlay layer.

when i use the overlay functionality with a custom MBTiles tilemill export with zoom levels 0-8 there is a problem that the map won't work for certain zoom levels. for zoom levels great than 4, the zoom-level part of the tile image links being generated will be set to -1 instead of the correct value from 5-8:
http://mysite/1.0.0/my_map/-1/18/20.png

as tmcw stated in the #mapbox irc channel there seems to be some PHP number conversion problem in D7 but we couldn't really figure out how exactly that's being caused...

Files: 
CommentFileSizeAuthor
#10 zoom-level-error-1165350-10.patch755 bytesmgifford

Comments

Title:Zoom level error with non-baselayer TMS layersZoom level error with non-baselayer TMS layers (resolution floats)

From this old issue, it seems like it is a general problem with floats and resolutions. #842026: Resolutions arrays must be cast to strings for export (marking other as duplicate)

interesting, do you think there is an easy fix to that issue?

i'm currently travelling central america to do some presentations about drupal and i would love to show tilemill integration as well. would be great if there was some fix / workarround to the issue described above as it basically prevents custom tilemill maps from being shown using openlayers.

zzolo, can you think of a way to tackle this? i am happy to do some testing here

i have modified the following file
all\modules\openlayers\js\openlayer.js at lines 64 and 70 for tms basemaps

// TODO: work around this scary code
if (map.projection === '900913') {
options.maxExtent = new OpenLayers.Bounds(
-20037508.34, -20037508.34, 20037508.34, 20037508.34);
options.units = "m";
}
if (map.projection === '4326') {
options.maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90);
}

options.maxResolution = "auto"; //1.40625;
options.controls = [];

Hi @MW. What exactly did you change? Can you provide a patch that is compbatible with everything else.

i will see if i can test this those days

lines modified:

added
options.units = "m";

options.maxResolution = "auto"; //1.40625;

changed 1.40625 to auto

this was from an earlier post re drupal 6 openlayers WMS and not changed for drupal 7 code

Using WMS as a Baselayer resolution issue
http://drupal.org/node/878644

i just tried MW's proposed fix, but it doesn't work in my case.

Can someone make an actual patch to test out?

StatusFileSize
new755 bytes

Here's a patch against the git repository to test.

Status:Active» Fixed

These changes have been made to 7.x-2.x. Testing would be appreciated.

Status:Fixed» Closed (fixed)

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