We don’t have stood up a TMS server yet, so I attached zip file of my output for MapTiler.
Quick fix options:
-
edit by hand the boundingbox to use lat/lon instead of meters in the tilemapresource.xml (but swap the x for y)
-
pass in the bounding box as an option in the TileMapServiceImageryProvider (note: do not need to swap x for y)
-
edit TileMapServiceImageryProvider:
// Try to load remaining parameters from XML
loadXML(url + ‘tilemapresource.xml’).then(function(xml) {
var tileFormatRegex = /tileformat/i;
var tileSetRegex = /tileset/i;
var tileSetsRegex = /tilesets/i;
var bboxRegex = /boundingbox/i;
var srsRegex = /srs/i; // XXX: GDIT fix
var format, bbox, tilesets;
var srs; // XXX: GDIT fix
var tilesetsList = ; //list of TileSets
// Allowing options properties to override XML values
var nodeList = xml.childNodes[0].childNodes;
// Iterate XML Document nodes for properties
for (var i = 0; i < nodeList.length; i++){
if (tileFormatRegex.test(nodeList.item(i).nodeName)){
format = nodeList.item(i);
} else if (tileSetsRegex.test(nodeList.item(i).nodeName)){
tilesets = nodeList.item(i); // Node list of TileSets
var tileSetNodes = nodeList.item(i).childNodes;
// Iterate the nodes to find all TileSets
for(var j = 0; j < tileSetNodes.length; j++){
if (tileSetRegex.test(tileSetNodes.item(j).nodeName)){
// Add them to tilesets list
tilesetsList.push(tileSetNodes.item(j));
}
}
} else if (bboxRegex.test(nodeList.item(i).nodeName)){
bbox = nodeList.item(i);
} else if (srsRegex.test(nodeList.item(i).nodeName)){ // XXX: GDIT fix
srs = nodeList.item(i).textContent;
}
}
that._fileExtension = defaultValue(options.fileExtension, format.getAttribute(‘extension’));
that._tileWidth = defaultValue(options.tileWidth, parseInt(format.getAttribute(‘width’), 10));
that._tileHeight = defaultValue(options.tileHeight, parseInt(format.getAttribute(‘height’), 10));
that._minimumLevel = defaultValue(options.minimumLevel, parseInt(tilesetsList[0].getAttribute(‘order’), 10));
that._maximumLevel = defaultValue(options.maximumLevel, parseInt(tilesetsList[tilesetsList.length - 1].getAttribute(‘order’), 10));
// rectangle handling
that._rectangle = options.rectangle;
if (!defined(that._rectangle)) {
// XXX: GDIT: check srs
var sw, ne;
if (srs == ‘EPSG:4326’) {
// XXX: GDIT Fix bounding box parse
// var sw = Cartographic.fromDegrees(parseFloat(bbox.getAttribute(‘miny’)), parseFloat(bbox.getAttribute(‘minx’)));
// var ne = Cartographic.fromDegrees(parseFloat(bbox.getAttribute(‘maxy’)), parseFloat(bbox.getAttribute(‘maxx’)));
sw = Cartographic.fromDegrees(parseFloat(bbox.getAttribute(‘minx’)), parseFloat(bbox.getAttribute(‘miny’)));
ne = Cartographic.fromDegrees(parseFloat(bbox.getAttribute(‘maxx’)), parseFloat(bbox.getAttribute(‘maxy’)));
}
else if (srs == ‘EPSG:900913’ || srs == ‘EPSG:3857’) {
// XXX: GDIT Convert bounding box from m to lat/lon instead
var projection = new WebMercatorProjection(Ellipsoid.WGS84);
sw = projection.unproject(new Cartesian2(parseFloat(bbox.getAttribute(‘minx’)), parseFloat(bbox.getAttribute(‘miny’))));
ne = projection.unproject(new Cartesian2(parseFloat(bbox.getAttribute(‘maxx’)), parseFloat(bbox.getAttribute(‘maxy’))));
}
else {
sw = Cartographic.fromDegrees(-180, -90);
ne = sw = Cartographic.fromDegrees(180, 90);
}
that._rectangle = new Rectangle(sw.longitude, sw.latitude, ne.longitude, ne.latitude);
} else {
that._rectangle = Rectangle.clone(that._rectangle);
}
temperature_OSGEO.zip (55.8 KB)