Ive adapted this code so that I can get tiles....but the x y values are now
wrong
I´m getting this..
http://DOMAIN/gwc/service/tms/1.0.0/zgb%3ARROP08@EPSG%3A900913@png/8/7/46.png
when I should be getting this..
http://DOMAIN/gwc/service/tms/1.0.01.0.0/zgb%3ARROP08@EPSG%3A900913@png/10/541/686.png
so 8/7/46.png instead of 10/541/686.png
How can I get this correct?...is this to do with resolutions?
yours,
Rob
________________________________
Von: Robert Buckley <[email protected]>
An: "[email protected]" <[email protected]>
Gesendet: 15:38 Mittwoch, 18.April 2012
Betreff: [OpenLayers-Users] TMS parsing algorithm
Hi,
I am trying to display a tms layer using openlayers by modifying some code
which displays cloudmade layers
I have some code which tries to construct the tile but it is failing throwing
this error...
400: Unable to parse number For input string: "zgb:RROP08@EPSG:900913@png8"
from tms/1.0.0/zgb:RROP08@EPSG:900913@png8/134/81.png
I have obviously got it totally wrong.....Could anyone direct me to the
documentation or say how to correctly parse the wms path?
yours,
Rob
//Code
OpenLayers.Layer.
MyTMSClass = OpenLayers.Class(OpenLayers.Layer.TMS, {
initialize: function(name, options) {
options = OpenLayers.Util.extend({
attribution: "",
maxExtent: new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
maxResolution: 156543.0339,
units: "m",
projection: "EPSG:900913",
isBaseLayer: true,
numZoomLevels: 19,
displayOutsideMaxExtent: true,
wrapDateLine: true,
styleId: 1
}, options);
var prefix = [options.key, options.styleId, 256].join('/') + '/';
var url = [
"http://mydomain/geoserver/gwc/service/tms/1.0.0/zgb%3ARROP08@EPSG%3A900913@png"
];
var newArguments = [name, url, options];
OpenLayers.Layer.TMS.prototype.initialize.apply(this, newArguments);
},
getURL: function (bounds) {
var res = this.map.getResolution();
var x = Math.round((bounds.left - this.maxExtent.left) / (res *
this.tileSize.w));
var y = Math.round((this.maxExtent.top - bounds.top) / (res *
this.tileSize.h));
var z = this.map.getZoom();
var limit = Math.pow(2, z);
if (y < 0 || y >= limit)
{
return "http://cloudmade.com/js-api/images/empty-tile.png";
}
else
{
x = ((x % limit) + limit) % limit;
var url = this.url;
var path = z + "/" + x + "/" + y + ".png";
if (url instanceof Array)
{
url = this.selectUrl(path, url);
}
return url + path;
}
},
CLASS_NAME: "OpenLayers.Layer.
MyTMSClass "
});
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users